Inhibit point editor while drag-selecting
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6155
This commit is contained in:
parent
13baea4900
commit
09ade9fe51
|
@ -634,4 +634,6 @@ const TOOL_EVENT EVENTS::ClearedEvent( TC_MESSAGE, TA_ACTION, "common.Interactiv
|
||||||
|
|
||||||
const TOOL_EVENT EVENTS::SelectedItemsModified( TC_MESSAGE, TA_ACTION, "common.Interactive.modified" );
|
const TOOL_EVENT EVENTS::SelectedItemsModified( TC_MESSAGE, TA_ACTION, "common.Interactive.modified" );
|
||||||
const TOOL_EVENT EVENTS::SelectedItemsMoved( TC_MESSAGE, TA_ACTION, "common.Interactive.moved" );
|
const TOOL_EVENT EVENTS::SelectedItemsMoved( TC_MESSAGE, TA_ACTION, "common.Interactive.moved" );
|
||||||
|
const TOOL_EVENT EVENTS::InhibitSelectionEditing( TC_MESSAGE, TA_ACTION, "common.Interactive.inhibit" );
|
||||||
|
const TOOL_EVENT EVENTS::UninhibitSelectionEditing( TC_MESSAGE, TA_ACTION, "common.Interactive.uninhibit" );
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,10 @@ public:
|
||||||
|
|
||||||
//< Selected items were moved, this can be very high frequency on the canvas, use with care
|
//< Selected items were moved, this can be very high frequency on the canvas, use with care
|
||||||
const static TOOL_EVENT SelectedItemsMoved;
|
const static TOOL_EVENT SelectedItemsMoved;
|
||||||
|
|
||||||
|
///> Used to inform tools that the selection should temporarily be non-editable
|
||||||
|
const static TOOL_EVENT InhibitSelectionEditing;
|
||||||
|
const static TOOL_EVENT UninhibitSelectionEditing;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __ACTIONS_H
|
#endif // __ACTIONS_H
|
||||||
|
|
|
@ -394,7 +394,7 @@ void POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( !m_selectionTool )
|
if( !m_selectionTool || aEvent.Matches( EVENTS::InhibitSelectionEditing ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const PCBNEW_SELECTION& selection = m_selectionTool->GetSelection();
|
const PCBNEW_SELECTION& selection = m_selectionTool->GetSelection();
|
||||||
|
@ -439,7 +439,8 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
|
||||||
grid.SetUseGrid( editFrame->IsGridVisible() );
|
grid.SetUseGrid( editFrame->IsGridVisible() );
|
||||||
|
|
||||||
if( !m_editPoints || evt->IsSelectionEvent() )
|
if( !m_editPoints || evt->IsSelectionEvent() ||
|
||||||
|
evt->Matches( EVENTS::InhibitSelectionEditing ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
EDIT_POINT* prevHover = m_hoveredPoint;
|
EDIT_POINT* prevHover = m_hoveredPoint;
|
||||||
|
@ -2148,4 +2149,6 @@ void POINT_EDITOR::setTransitions()
|
||||||
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
|
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
|
||||||
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );
|
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );
|
||||||
Go( &POINT_EDITOR::changeEditMethod, ACTIONS::changeEditMethod.MakeEvent() );
|
Go( &POINT_EDITOR::changeEditMethod, ACTIONS::changeEditMethod.MakeEvent() );
|
||||||
|
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::InhibitSelectionEditing );
|
||||||
|
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UninhibitSelectionEditing );
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,6 +285,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
else if( evt->IsDrag( BUT_LEFT ) )
|
else if( evt->IsDrag( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->FocusOnItem( nullptr );
|
||||||
|
m_toolMgr->ProcessEvent( EVENTS::InhibitSelectionEditing );
|
||||||
|
|
||||||
if( modifier_enabled || dragAlwaysSelects )
|
if( modifier_enabled || dragAlwaysSelects )
|
||||||
{
|
{
|
||||||
|
@ -756,6 +757,8 @@ bool SELECTION_TOOL::selectMultiple()
|
||||||
if( !cancelled )
|
if( !cancelled )
|
||||||
m_selection.ClearReferencePoint();
|
m_selection.ClearReferencePoint();
|
||||||
|
|
||||||
|
m_toolMgr->ProcessEvent( EVENTS::UninhibitSelectionEditing );
|
||||||
|
|
||||||
return cancelled;
|
return cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue