Selection tool uses the real drag origin to compute offset when dragging items.

This commit is contained in:
Maciej Suminski 2014-07-09 16:50:31 +02:00
parent b8fd1de71c
commit 4068d6c858
1 changed files with 4 additions and 1 deletions

View File

@ -30,6 +30,7 @@
#include <tool/tool_manager.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <ratsnest_data.h>
#include <confirm.h>
@ -175,9 +176,11 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
}
else
{
const VECTOR2D& dragOrigin = getView()->GetGAL()->GetGridPoint( evt->DragOrigin() );
// Update dragging offset (distance between cursor and the first dragged item)
m_offset = static_cast<BOARD_ITEM*>( selection.items.GetPickedItem( 0 ) )->GetPosition() -
wxPoint( m_cursor.x, m_cursor.y );
wxPoint( dragOrigin.x, dragOrigin.y );
}
m_dragging = true;