Check if selection is primary tool
Previously, we were checking if the selection tool was the top of the stack but this ignored many other "secondary" tools that might be running such as the point editor. These still allow the selection tool to handle events such as clicks. This change allows the selection tool to handle clicks when it is the primary tool on the stack rather than the top Fixes https://gitlab.com/kicad/code/kicad/issues/9110
This commit is contained in:
parent
4ee0b28ffc
commit
c8b2e69332
|
@ -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 )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue