Change persistent 45° state to only drawing

Move/edit points have a lossy state that holds only for the time in
which the tool is active.  It reverts back to non-constrained after
completion of the move/point edit

Fixes https://gitlab.com/kicad/code/kicad/issues/9574
This commit is contained in:
Seth Hillbrand
2021-11-17 15:38:28 -08:00
parent bfad40bdcc
commit 1d2fd6d271
3 changed files with 16 additions and 4 deletions
+7 -1
View File
@@ -429,6 +429,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
updateEditedPoint( aEvent );
m_refill = false;
bool inDrag = false;
bool lock45 = false;
BOARD_COMMIT commit( editFrame );
LSET snapLayers = item->GetLayerSet();
@@ -524,7 +525,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
}
// The alternative constraint limits to 45 degrees
if( Is45Limited() )
if( lock45 )
m_altConstraint->Apply();
else
m_editedPoint->ApplyConstraint();
@@ -570,6 +571,11 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
m_refill = true;
}
else if( evt->IsAction( &PCB_ACTIONS::toggle45 ) )
{
lock45 = !lock45;
evt->SetPassEvent( false );
}
else if( evt->IsCancelInteractive() || evt->IsActivate() )
{
if( inDrag ) // Restore the last change