Force immediate action for auto start wire feature

Fixes https://gitlab.com/kicad/code/kicad/issues/7503
This commit is contained in:
Mikolaj Wielgus 2021-02-21 13:45:50 +01:00 committed by Seth Hillbrand
parent 3bc9d7b95e
commit f9c42585fb
4 changed files with 12 additions and 2 deletions

View File

@ -61,6 +61,8 @@ void TOOL_EVENT::init()
// Cancel tool doesn't contain a position
if( IsCancel() )
m_hasPosition = false;
m_forceImmediate = false;
}
@ -225,4 +227,4 @@ bool TOOL_EVENT::IsSimulator() const
{
return( m_commandStr.is_initialized()
&& m_commandStr.get().find( "Simulation" ) != GetCommandStr()->npos );
}
}

View File

@ -1118,7 +1118,8 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
{
// An tool-selection-event has no position
if( mod_event.GetCommandStr().is_initialized()
&& mod_event.GetCommandStr().get() != GetToolHolder()->CurrentToolName() )
&& mod_event.GetCommandStr().get() != GetToolHolder()->CurrentToolName()
&& !mod_event.ForceImmediate() )
{
mod_event.SetHasPosition( false );
}

View File

@ -401,6 +401,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
getViewControls()->ForceCursorPosition( true, snappedCursorPos );
newEvt->SetMousePosition( snappedCursorPos );
newEvt->SetHasPosition( true );
newEvt->SetForceImmediate( true );
m_toolMgr->ProcessEvent( *newEvt );
continueSelect = false;

View File

@ -258,6 +258,11 @@ public:
bool HasPosition() const { return m_hasPosition; }
void SetHasPosition( bool aHasPosition ) { m_hasPosition = aHasPosition; }
///< Returns if the action associated with this event should be treated as immediate regardless
///< of the current immediate action settings.
bool ForceImmediate() const { return m_forceImmediate; }
void SetForceImmediate( bool aForceImmediate = true ) { m_forceImmediate = aForceImmediate; }
TOOL_BASE* FirstResponder() const { return m_firstResponder; }
void SetFirstResponder( TOOL_BASE* aTool ) { m_firstResponder = aTool; }
@ -520,6 +525,7 @@ private:
TOOL_ACTION_SCOPE m_scope;
bool m_passEvent;
bool m_hasPosition;
bool m_forceImmediate;
///< Difference between mouse cursor position and
///< the point where dragging event has started