From 0b2b8b150dd9b7f35ca114e13764bc0318214423 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 3 Oct 2020 15:05:28 -0400 Subject: [PATCH] Use the event position always instead of the view cursor position Fix #5850 --- eeschema/tools/ee_selection_tool.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index caf42d9082..246505db2d 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -321,9 +321,6 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) EE_GRID_HELPER grid( m_toolMgr ); - VECTOR2I rawPos = evt->IsPrime() ? evt->Position() : getViewControls()->GetMousePosition(); - VECTOR2I cursorPos = grid.BestSnapAnchor( rawPos, nullptr ); - // Single click? Select single object if( evt->IsClick( BUT_LEFT ) ) { @@ -341,8 +338,10 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( collector.GetCount() == 1 ) { // Check if we want to auto start wires + VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr ); + if( m_frame->eeconfig()->m_Drawing.auto_start_wires - && collector[0]->IsPointClickableAnchor( (wxPoint) cursorPos ) ) + && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) ) { OPT_TOOL_EVENT newEvt = EE_ACTIONS::drawWire.MakeEvent(); auto* params = newEvt->Parameter(); @@ -507,8 +506,10 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( collector.GetCount() == 1 ) { + VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr ); + if( m_frame->eeconfig()->m_Drawing.auto_start_wires - && collector[0]->IsPointClickableAnchor( (wxPoint) cursorPos ) ) + && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) ) { displayPencil = true; }