Get consistent point for gfx import

TopLeftItem() should always return same element for our import

Fixes https://gitlab.com/kicad/code/kicad/issues/13041
This commit is contained in:
Seth Hillbrand 2022-11-30 12:25:03 -08:00
parent cf33f33899
commit b31349b679
1 changed files with 2 additions and 2 deletions

View File

@ -1602,7 +1602,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
// Now move the new items to the current cursor position:
VECTOR2I cursorPos = m_controls->GetCursorPosition( !aEvent.DisableGridSnapping() );
VECTOR2I delta = cursorPos - static_cast<BOARD_ITEM*>( preview.Front() )->GetPosition();
VECTOR2I delta = cursorPos - static_cast<BOARD_ITEM*>( preview.GetTopLeftItem() )->GetPosition();
for( BOARD_ITEM* item : selectedItems )
item->Move( delta );
@ -1638,7 +1638,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
}
else if( evt->IsMotion() )
{
delta = cursorPos - static_cast<BOARD_ITEM*>( preview.Front() )->GetPosition();
delta = cursorPos - static_cast<BOARD_ITEM*>( preview.GetTopLeftItem() )->GetPosition();
for( BOARD_ITEM* item : selectedItems )
item->Move( delta );