Remove overly-complex snapping layer for moving objects.
We now have a hotkey to select Active Layer vs All Layers, which gives the user more control. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16683
This commit is contained in:
parent
5c4313587b
commit
37c185f437
|
@ -298,36 +298,13 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
{
|
||||
sTool->FilterCollectorForMarkers( aCollector );
|
||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||
sTool->FilterCollectorForFreePads( aCollector );
|
||||
},
|
||||
// Prompt user regarding locked items if in board editor and in free-pad-mode (if
|
||||
// we're not in free-pad mode we delay this until the second RequestSelection()).
|
||||
!m_isFootprintEditor && cfg->m_AllowFreePads );
|
||||
true /* prompt user regarding locked items */ );
|
||||
|
||||
if( m_dragging || selection.Empty() )
|
||||
return false;
|
||||
|
||||
LSET item_layers = selection.GetSelectionLayers();
|
||||
bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call
|
||||
// to RequestSelection() below
|
||||
VECTOR2I pickedReferencePoint;
|
||||
|
||||
// Now filter out pads if not in free pads mode. We cannot do this in the first
|
||||
// RequestSelection() as we need the item_layers when a pad is the selection front.
|
||||
if( !m_isFootprintEditor && !cfg->m_AllowFreePads )
|
||||
{
|
||||
selection = m_selectionTool->RequestSelection(
|
||||
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
||||
{
|
||||
sTool->FilterCollectorForMarkers( aCollector );
|
||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||
sTool->FilterCollectorForFreePads( aCollector );
|
||||
},
|
||||
true /* prompt user regarding locked items */ );
|
||||
}
|
||||
|
||||
if( selection.Empty() )
|
||||
return false;
|
||||
|
||||
editFrame->PushTool( aEvent );
|
||||
Activate();
|
||||
|
||||
|
@ -376,7 +353,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
{
|
||||
if( BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( item ) )
|
||||
{
|
||||
if( !is_hover )
|
||||
if( !selection.IsHover() )
|
||||
orig_items.push_back( boardItem );
|
||||
|
||||
sel_items.push_back( boardItem );
|
||||
|
@ -393,10 +370,12 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
}
|
||||
}
|
||||
|
||||
VECTOR2I pickedReferencePoint;
|
||||
|
||||
if( moveWithReference && !pickReferencePoint( _( "Select reference point for move..." ), "", "",
|
||||
pickedReferencePoint ) )
|
||||
{
|
||||
if( is_hover )
|
||||
if( selection.IsHover() )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
||||
|
||||
editFrame->PopTool( aEvent );
|
||||
|
@ -431,6 +410,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
VECTOR2D bboxMovement;
|
||||
BOX2I originalBBox;
|
||||
bool updateBBox = true;
|
||||
LSET layers( editFrame->GetActiveLayer() );
|
||||
PCB_GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() );
|
||||
TOOL_EVENT copy = aEvent;
|
||||
TOOL_EVENT* evt = ©
|
||||
|
@ -480,7 +460,7 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
|
||||
VECTOR2I mousePos( controls->GetMousePosition() );
|
||||
|
||||
m_cursor = grid.BestSnapAnchor( mousePos, item_layers,
|
||||
m_cursor = grid.BestSnapAnchor( mousePos, layers,
|
||||
grid.GetSelectionGrid( selection ), sel_items );
|
||||
|
||||
if( controls->GetSettings().m_lastKeyboardCursorPositionValid )
|
||||
|
|
|
@ -105,17 +105,3 @@ const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
|
|||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
const LSET PCB_SELECTION::GetSelectionLayers()
|
||||
{
|
||||
LSET retval;
|
||||
|
||||
for( EDA_ITEM* item : m_items )
|
||||
{
|
||||
if( BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item ) )
|
||||
retval |= board_item->GetLayerSet();
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@ public:
|
|||
EDA_ITEM* GetTopLeftItem( bool aFootprintsOnly = false ) const override;
|
||||
|
||||
const std::vector<KIGFX::VIEW_ITEM*> updateDrawList() const override;
|
||||
|
||||
const LSET GetSelectionLayers();
|
||||
};
|
||||
|
||||
#endif // PCB_SELECTION_H
|
||||
|
|
|
@ -528,11 +528,6 @@ const std::vector<KIGFX::VIEW_ITEM*> PCB_SELECTION::updateDrawList() const
|
|||
}
|
||||
|
||||
|
||||
const LSET PCB_SELECTION::GetSelectionLayers()
|
||||
{
|
||||
return LSET();
|
||||
}
|
||||
|
||||
#if 0
|
||||
#include <3d_canvas/board_adapter.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue