From 7e8b1906b2457dfd2af0d19483f0ca7d3d926e65 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 5 Feb 2014 10:17:14 +0100 Subject: [PATCH] Grip margin is relative to the world's zoom. --- pcbnew/tools/selection_tool.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 17fcd05ee7..4f2489e81c 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -568,16 +568,15 @@ void SELECTION_TOOL::deselectVisually( BOARD_ITEM* aItem ) const bool SELECTION_TOOL::containsSelected( const VECTOR2I& aPoint ) const { - const unsigned GRIP_MARGIN = 500000; + const unsigned GRIP_MARGIN = 20; + VECTOR2D margin = getView()->ToWorld( VECTOR2D( GRIP_MARGIN, GRIP_MARGIN ), false ); // Check if the point is located within any of the currently selected items bounding boxes - std::set::iterator it, it_end; - for( unsigned int i = 0; i < m_selection.items.GetCount(); ++i ) { BOARD_ITEM* item = static_cast( m_selection.items.GetPickedItem( i ) ); BOX2I itemBox = item->ViewBBox(); - itemBox.Inflate( GRIP_MARGIN ); // Give some margin for gripping an item + itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item if( itemBox.Contains( aPoint ) ) return true;