From 2cf4cb937f2f9002a5ca1c42777959a33d19cf70 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 4 Aug 2022 09:56:31 -0700 Subject: [PATCH] Fix graphic snapping If the user has requested the ability to snap to graphics, we want to add any of the graphical layers to the limit list --- pcbnew/footprint.cpp | 13 +++++++++++++ pcbnew/footprint.h | 2 ++ pcbnew/tools/edit_tool.cpp | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 0f29cd8e69..5d7aa7962c 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -734,6 +734,19 @@ EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const } +LSET FOOTPRINT::GetLayerSet() const +{ + LSET retval; + + RunOnChildren( [&retval]( BOARD_ITEM* aItem ) + { + retval |= aItem->GetLayerSet(); + } ); + + return retval; +} + + const EDA_RECT FOOTPRINT::GetBoundingBox() const { return GetBoundingBox( true, true ); diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 5055d812c6..ef92ae2292 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -166,6 +166,8 @@ public: const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const; + LSET GetLayerSet() const override; + PADS& Pads() { return m_pads; } const PADS& Pads() const { return m_pads; } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 0d8b759572..3a76076af6 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -756,6 +756,10 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe LSET item_layers = selection.GetSelectionLayers(); bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call // to RequestSelection() below + + if( editFrame->GetMagneticItemsSettings()->graphics ) + item_layers |= LSET::UserDefinedLayers() | LSET::UserMask(); + VECTOR2I pickedReferencePoint; // Now filter out pads if not in free pads mode. We cannot do this in the first