GRID_HELPER: filter selected items from snap target

When considering potential targets for snap points, we need to exclude
the currently selected item as this will mean that we always snap to
ourselves when editing an existing item.

Fixes: lp:1796507
* https://bugs.launchpad.net/kicad/+bug/1796507
This commit is contained in:
Seth Hillbrand 2018-10-06 19:36:49 -07:00
parent d669ae043a
commit 3b27049f6e
1 changed files with 7 additions and 1 deletions

View File

@ -240,7 +240,13 @@ std::set<BOARD_ITEM*> GRID_HELPER::queryVisible( const BOX2I& aArea ) const
{ {
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first );
if( view->IsVisible( item ) && ( !isHighContrast || activeLayers.count( it.second ) ) ) // 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
if( view->IsVisible( item )
&& ( !isHighContrast || activeLayers.count( it.second ) )
&& !item->IsSelected() )
items.insert ( item ); items.insert ( item );
} }