Second pass at fixing warping and grids

First attempt caused additional problems for #21535

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18196

(cherry picked from commit 2cdeb0cd7c618d2ff3f5dc95c53a6b217a55af9d)
This commit is contained in:
Seth Hillbrand 2025-08-31 07:52:35 -07:00 committed by jean-pierre charras
parent b47f8f4504
commit 5a5191361f

View File

@ -667,15 +667,30 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
} }
else else
{ {
// Check if user wants to warp the mouse to origin of moved object VECTOR2I snapped = grid.Align( m_cursor, grid.GetSelectionGrid( selection ) );
if( !editFrame->GetMoveWarpsCursor() ) VECTOR2I delta = snapped - m_cursor;
m_cursor = originalCursorPos; // No, so use original mouse pos instead
selection.SetReferencePoint( m_cursor ); if( delta.x || delta.y )
grid.SetAuxAxes( true, m_cursor ); {
for( BOARD_ITEM* item : sel_items )
{
if( item->GetParent() && item->GetParent()->IsSelected() )
continue;
item->Move( delta );
}
}
selection.SetReferencePoint( snapped );
grid.SetAuxAxes( true, snapped );
if( !editFrame->GetMoveWarpsCursor() )
m_cursor = originalCursorPos;
else
m_cursor = snapped;
} }
originalPos = m_cursor; originalPos = selection.GetReferencePoint();
} }
// Update variables for bounding box collision calculations // Update variables for bounding box collision calculations