diff --git a/eeschema/tools/ee_picker_tool.cpp b/eeschema/tools/ee_picker_tool.cpp index 1a7f0f55cf..707f837b76 100644 --- a/eeschema/tools/ee_picker_tool.cpp +++ b/eeschema/tools/ee_picker_tool.cpp @@ -40,12 +40,15 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) KIGFX::VIEW_CONTROLS* controls = getViewControls(); int finalize_state = WAIT_CANCEL; + // To many things are off-grid in LibEdit; turn snapping off. + bool snap = !m_isLibEdit; + setControls(); while( TOOL_EVENT* evt = Wait() ) { m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE ); - VECTOR2D cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) ); + VECTOR2D cursorPos = controls->GetCursorPosition( snap && !evt->Modifier( MD_ALT ) ); if( evt->IsClick( BUT_LEFT ) ) { diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 8e41f0a1b5..fc71708513 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -482,7 +482,7 @@ EDA_ITEM* EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* // Apply some ugly heuristics to avoid disambiguation menus whenever possible if( collector.GetCount() > 1 && !m_skip_heuristics ) { - guessSelectionCandidates( collector, aWhere ); + GuessSelectionCandidates( collector, aWhere ); } // If still more than one item we're going to have to ask the user. @@ -516,12 +516,12 @@ EDA_ITEM* EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* } -void EE_SELECTION_TOOL::guessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos ) +void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos ) { // There are certain parent/child and enclosure combinations that can be handled // automatically. - // Prefer exact hits to a sloppy ones + // Prefer exact hits to sloppy ones int exactHits = 0; for( int i = collector.GetCount() - 1; i >= 0; --i ) diff --git a/eeschema/tools/ee_selection_tool.h b/eeschema/tools/ee_selection_tool.h index e3739819c4..6faed4987d 100644 --- a/eeschema/tools/ee_selection_tool.h +++ b/eeschema/tools/ee_selection_tool.h @@ -130,6 +130,12 @@ public: void ClearSelection(); + /** + * Apply heuristics to try and determine a single object when multiple are found under the + * cursor. + */ + void GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos ); + /** * Function SelectionMenu() * Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single @@ -155,12 +161,6 @@ private: */ bool selectMultiple(); - /** - * Apply heuristics to try and determine a single object when multiple are found under the - * cursor. - */ - void guessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aWhere ); - /** * Allows the selection of a single item from a list via pop-up menu. The items are * highlighted on the canvas when hovered in the menu. The collector is trimmed to diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index e8ae85d1fb..1281ae71d5 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -307,12 +307,14 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) EE_COLLECTOR collector; collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); collector.Collect( m_frame->GetCurPart(), nonFields, (wxPoint) aPos ); + + EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); + selectionTool->GuessSelectionCandidates( collector, aPos ); + EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr; if( m_pickerItem != item ) { - EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); - if( m_pickerItem ) selectionTool->UnbrightenItem( m_pickerItem ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 772b5d87bb..7d106b2333 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -979,12 +979,14 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) EE_COLLECTOR collector; collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); collector.Collect( m_frame->GetScreen()->GetDrawItems(), deletableItems, (wxPoint) aPos ); + + EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); + selectionTool->GuessSelectionCandidates( collector, aPos ); + EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr; if( m_pickerItem != item ) { - EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); - if( m_pickerItem ) selectionTool->UnbrightenItem( m_pickerItem );