GRID_HELPER: Fix ALT issue with snapping
Disabling the grid should leave the snapping in place. But our disabler returned the current point as closest, effectively always ensuring the cursor position was the closest snap. This only uses grid when requested.
This commit is contained in:
parent
ae7f04a20c
commit
9505df5997
|
@ -282,7 +282,6 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLaye
|
|||
}
|
||||
|
||||
ANCHOR* nearest = nearestAnchor( aOrigin, CORNER | SNAPPABLE, aLayers );
|
||||
|
||||
VECTOR2I nearestGrid = Align( aOrigin );
|
||||
double gridDist = ( nearestGrid - aOrigin ).EuclideanNorm();
|
||||
|
||||
|
@ -290,7 +289,7 @@ VECTOR2I GRID_HELPER::BestSnapAnchor( const VECTOR2I& aOrigin, const LSET& aLaye
|
|||
{
|
||||
double snapDist = nearest->Distance( aOrigin );
|
||||
|
||||
if( nearest && snapDist <= gridDist )
|
||||
if( nearest && ( !m_enableGrid || snapDist <= gridDist ) )
|
||||
{
|
||||
m_viewSnapPoint.SetPosition( nearest->pos );
|
||||
m_frame->GetGalCanvas()->GetView()->SetVisible( &m_viewSnapPoint, true );
|
||||
|
|
|
@ -363,7 +363,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
//TODO: unify the constraints to solve simultaneously instead of sequentially
|
||||
m_editedPoint->SetPosition( grid.Align( evt->Position() ) );
|
||||
m_editedPoint->SetPosition( grid.BestSnapAnchor( evt->Position(), snapLayers ) );
|
||||
bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
|
||||
|
||||
if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
|
||||
|
|
Loading…
Reference in New Issue