From ced6613bb5f76bea6ffdab39bad9a8a307c0c298 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 15 Jul 2014 16:33:46 +0200 Subject: [PATCH] Fixed offset of dragged items when the moving tool is invoked by the hotkey (GAL). --- pcbnew/tools/edit_tool.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index f174753c6d..664f59a499 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -176,11 +176,16 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) } else { - const VECTOR2D& dragOrigin = getView()->GetGAL()->GetGridPoint( evt->DragOrigin() ); + VECTOR2D origin; + + if( evt->IsDrag( BUT_LEFT ) ) + origin = getView()->GetGAL()->GetGridPoint( evt->DragOrigin() ); + else + origin = getViewControls()->GetCursorPosition(); // Update dragging offset (distance between cursor and the first dragged item) m_offset = static_cast( selection.items.GetPickedItem( 0 ) )->GetPosition() - - wxPoint( dragOrigin.x, dragOrigin.y ); + wxPoint( origin.x, origin.y ); } m_dragging = true;