diff --git a/common/tool/selection_tool.cpp b/common/tool/selection_tool.cpp index 702eb499a0..d7ceace584 100644 --- a/common/tool/selection_tool.cpp +++ b/common/tool/selection_tool.cpp @@ -33,7 +33,8 @@ SELECTION_TOOL::SELECTION_TOOL() : m_skip_heuristics( false ), m_highlight_modifier( false ), m_drag_additive( false ), - m_drag_subtractive( false ) + m_drag_subtractive( false ), + m_canceledMenu( false ) { } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 4425ff3de5..4ff4e3ee3f 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -346,7 +346,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( evt->IsMouseDown( BUT_LEFT ) ) { // Avoid triggering when running under other tools - if( m_toolMgr->GetCurrentTool() == this ) + if( m_frame->ToolStackIsEmpty() ) m_disambiguateTimer.StartOnce( 500 ); } // Single click? Select single object @@ -730,8 +730,8 @@ int EE_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent ) VECTOR2I pos = m_toolMgr->GetMousePosition(); m_skip_heuristics = true; - SelectPoint( pos, EE_COLLECTOR::AllItems, nullptr, nullptr, false, m_additive, m_subtractive, - m_exclusive_or ); + SelectPoint( pos, EE_COLLECTOR::AllItems, nullptr, &m_canceledMenu, false, m_additive, + m_subtractive, m_exclusive_or ); m_skip_heuristics = false; return 0; diff --git a/include/tool/selection_tool.h b/include/tool/selection_tool.h index ec7cc25a17..edd84eed31 100644 --- a/include/tool/selection_tool.h +++ b/include/tool/selection_tool.h @@ -54,6 +54,8 @@ protected: bool m_drag_additive; // Add multiple items to selection bool m_drag_subtractive; // Remove multiple from selection + bool m_canceledMenu; // Sets to true if the disambiguation menu was cancelled + wxTimer m_disambiguateTimer; // Timer to show the disambiguate menu }; diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index 16ddd2fb1d..ee4e52f009 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -113,7 +113,7 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( evt->IsMouseDown( BUT_LEFT ) ) { // Avoid triggering when running under other tools - if( m_toolMgr->GetCurrentTool() == this ) + if( m_frame->ToolStackIsEmpty() ) m_disambiguateTimer.StartOnce( 500 ); } // Single click? Select single object @@ -232,7 +232,7 @@ int PL_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent ) VECTOR2I pos = m_toolMgr->GetMousePosition(); m_skip_heuristics = true; - SelectPoint( pos ); + SelectPoint( pos, &m_canceledMenu ); m_skip_heuristics = false; return 0; diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 5f84cfec33..efe4d4c771 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -265,14 +265,14 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) else if( evt->IsMouseDown( BUT_LEFT ) ) { // Avoid triggering when running under other tools - if( m_toolMgr->GetCurrentTool() == this ) + if( m_frame->ToolStackIsEmpty() ) m_disambiguateTimer.StartOnce( 500 ); } else if( evt->IsClick( BUT_LEFT ) ) { // If there is no disambiguation, this routine is still running and will // register a `click` event when released - if( m_disambiguateTimer.IsRunning() ) + if( !m_disambiguateTimer.IsRunning() ) { m_disambiguateTimer.Stop(); @@ -285,6 +285,8 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) selectPoint( evt->Position() ); } } + + m_canceledMenu = false; } else if( evt->IsClick( BUT_RIGHT ) ) { @@ -900,7 +902,7 @@ int PCB_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent ) VECTOR2I pos = m_toolMgr->GetMousePosition(); m_skip_heuristics = true; - selectPoint( pos ); + selectPoint( pos, false, &m_canceledMenu ); m_skip_heuristics = false; return 0;