pcbnew: snap after constraint and grid

This is temporary until we figure out a way to do multiple constraint
handling in GRID_HELPER or the EC_* class.  This will work as long as
the EC constraint helper places the endpoint on either the primary or
aux grid.

    Fixes: lp:1796540
    * https://bugs.launchpad.net/kicad/+bug/1796540
This commit is contained in:
Seth Hillbrand 2018-10-07 08:00:41 -07:00
parent de793aa43d
commit ae7f04a20c
1 changed files with 3 additions and 5 deletions

View File

@ -362,8 +362,8 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
grid.SetAuxAxes( true, m_original.GetPosition(), true );
}
m_editedPoint->SetPosition( grid.BestSnapAnchor( evt->Position(), snapLayers ) );
//TODO: unify the constraints to solve simultaneously instead of sequentially
m_editedPoint->SetPosition( grid.Align( evt->Position() ) );
bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
@ -374,9 +374,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
else
m_editedPoint->ApplyConstraint();
// There is a chance that the constraint above knocked us off grid
// This ensures the final point is on a grid line if requested.
m_editedPoint->SetPosition( grid.Align( m_editedPoint->GetPosition() ) );
m_editedPoint->SetPosition( grid.BestSnapAnchor( m_editedPoint->GetPosition(), snapLayers ) );
updateItem();
updatePoints();