GRID_HELPER: Filter targets based on dragging
Filtering based on selection ignores the use case where we are measuring to a selected item. This utilizes the dragged flag to prevent snapping based on the current state of the item drag. Fixes: lp:1801089 * https://bugs.launchpad.net/kicad/+bug/1801089
This commit is contained in:
parent
cf20b39ddc
commit
c24f70ba1e
|
@ -438,6 +438,9 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
for( auto item : selection )
|
||||
item->SetFlags( IS_DRAGGED ); //todo: flags structure rework
|
||||
|
||||
editFrame->UndoRedoBlock( true );
|
||||
m_cursor = controls->GetCursorPosition();
|
||||
|
||||
|
@ -558,6 +561,9 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( unselect || restore_state )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
for( auto item : selection )
|
||||
item->ClearFlags( IS_DRAGGED ); //todo: flags structure rework
|
||||
|
||||
if( restore_state )
|
||||
m_commit->Revert();
|
||||
else
|
||||
|
|
|
@ -241,12 +241,11 @@ std::set<BOARD_ITEM*> GRID_HELPER::queryVisible( const BOX2I& aArea ) const
|
|||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first );
|
||||
|
||||
// The item must be visible and on an active layer
|
||||
// It cannot be selected because this routine is used to calculate snapping,
|
||||
// so the selected it is what we are snapping _from_ and should not be
|
||||
// considered a snap target
|
||||
// It cannot be moving as a moving item is being snapped _from_
|
||||
// rather than considered a potential target
|
||||
if( view->IsVisible( item )
|
||||
&& ( !isHighContrast || activeLayers.count( it.second ) )
|
||||
&& !item->IsSelected() )
|
||||
&& !item->IsDragging() )
|
||||
items.insert ( item );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue