← Back to team overview

kicad-developers team mailing list archive

[PATCH] Allow items to be moved from all anchor points

 

A change in commit 57310001350 caused kicad to stop allowing users
to move items like footprints, arcs and lines using anchors other
than the center point.

This was caused by the new code that stores reference points for
clipboard pasting, a call to updateModificationPoint() prevented
some old code paths from executing, which caused the selection to
snap into the cursor, always using the center anchor.

This fix moves the call within the if-cases that need it, and adds
a ClearReferencePoint call when the selection is "dropped" to allow
the user to grab the same selection again from a different anchor.
From 630f2895040eef1efda17685dc7054910a746798 Mon Sep 17 00:00:00 2001
From: Jose I Romero <jromero@xxxxxxxxxxxxxxxx>
Date: Mon, 20 Nov 2017 10:14:41 -0600
Subject: [PATCH] Allow items to be moved from all anchor points

A change in commit 57310001350 caused kicad to stop allowing users
to move items like footprints, arcs and lines using anchors other
than the center point.

This was caused by the new code that stores reference points for
clipboard pasting, a call to updateModificationPoint() prevented
some old code paths from executing, which caused the selection to
snap into the cursor, always using the center anchor.

This fix moves the call within the if-cases that need it, and adds
a ClearReferencePoint call when the selection is "dropped" to allow
the user to grab the same selection again from a different anchor.
---
 pcbnew/tools/edit_tool.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index 2ae7a4d8b..e6aaad55c 100644
--- a/pcbnew/tools/edit_tool.cpp
+++ b/pcbnew/tools/edit_tool.cpp
@@ -450,8 +450,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
 
                     m_cursor = controls->GetCursorPosition();
 
-                    updateModificationPoint( selection );
-
                     if ( selection.HasReferencePoint() )
                     {
                         // start moving with the reference point attached to the cursor
@@ -469,11 +467,13 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
                     {
                         // Set the current cursor position to the first dragged item origin, so the
                         // movement vector could be computed later
+                        updateModificationPoint( selection );
                         m_cursor = grid.BestDragOrigin( originalCursorPos, curr_item );
                         grid.SetAuxAxes( true, m_cursor );
                     }
                     else
                     {
+                        updateModificationPoint( selection );
                         m_cursor = grid.Align( m_cursor );
                     }
 
@@ -556,6 +556,8 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
     controls->SetAutoPan( false );
 
     m_dragging = false;
+    // Discard reference point when selection is "dropped" onto the board (ie: not dragging anymore)
+    selection.ClearReferencePoint();
 
     if( unselect || restore )
         m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
-- 
2.11.0


Follow ups