mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
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:
parent
b47f8f4504
commit
5a5191361f
@ -667,15 +667,30 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if user wants to warp the mouse to origin of moved object
|
||||
if( !editFrame->GetMoveWarpsCursor() )
|
||||
m_cursor = originalCursorPos; // No, so use original mouse pos instead
|
||||
VECTOR2I snapped = grid.Align( m_cursor, grid.GetSelectionGrid( selection ) );
|
||||
VECTOR2I delta = snapped - m_cursor;
|
||||
|
||||
selection.SetReferencePoint( m_cursor );
|
||||
grid.SetAuxAxes( true, m_cursor );
|
||||
if( delta.x || delta.y )
|
||||
{
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user