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:
parent
bfad40bdcc
commit
1d2fd6d271
|
@ -845,6 +845,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
TOOL_EVENT* evt = &aEvent;
|
||||
VECTOR2I prevPos;
|
||||
|
||||
bool lock45 = false;
|
||||
bool eatFirstMouseUp = true;
|
||||
bool hasRedrawn3D = false;
|
||||
bool allowRedraw3D = editFrame->GetDisplayOptions().m_Live3DRefresh;
|
||||
|
@ -890,7 +891,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
if( !selection.HasReferencePoint() )
|
||||
originalPos = m_cursor;
|
||||
|
||||
if( Is45Limited() )
|
||||
if( lock45 )
|
||||
{
|
||||
VECTOR2I moveVector = m_cursor - originalPos;
|
||||
m_cursor = originalPos + GetVectorSnapped45( moveVector );
|
||||
|
@ -976,7 +977,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
// start moving with the reference point attached to the cursor
|
||||
grid.SetAuxAxes( false );
|
||||
|
||||
if( Is45Limited() )
|
||||
if( lock45 )
|
||||
{
|
||||
VECTOR2I moveVector = m_cursor - originalPos;
|
||||
m_cursor = originalPos + GetVectorSnapped45( moveVector );
|
||||
|
@ -1091,6 +1092,11 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
|
|||
|
||||
break; // finish
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::toggle45 ) )
|
||||
{
|
||||
lock45 = !lock45;
|
||||
evt->SetPassEvent( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
* Should the tool use its 45° mode option?
|
||||
* @return True if set to use 45°
|
||||
*/
|
||||
bool Is45Limited() const;
|
||||
virtual bool Is45Limited() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue