← Back to team overview

kicad-developers team mailing list archive

Re: Changed behaviour: Moving objects by their pads not possible anymore

 

I think i found a possible fix that avoids interfering with the copy and
paste origin logic added (even on single element pastes):

diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index bb6fe3f80..f8ff9ce32 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 );
-

This call guarantees that selection.HasReferencePoint() always returns
true, so the other two code paths never get executed, so i removed it, as
it is not necessary in the first if case:


                     if ( selection.HasReferencePoint() )
                     {
                         // start moving with the reference point attached
to the cursor


And then added it back for the other two cases:


@@ -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 );
                     }


Patch file attached.


Thanks,
Jose


On Sun, Nov 19, 2017 at 6:04 PM, José Ignacio <jose.cyborg@xxxxxxxxx> wrote:

> I can confirm this, it also affects the movement of graphic items like
> lines and arcs to very disturbing results. It will always use the
> centerpoint of an arc or first point of a line, snapping the part to the
> cursor every time. I ran a git bisect and it looks like the first commit
> that introduced that behavior was  57310001350ead3a6b7870f19982f77b88ac5b8a,
> with the introduction of storage of offsets in the SELECTION class.
>
> I couldn't find a satisfactory fix because i'm not familiar with the
> design of the edit tool, the expected behavior is that when you press M
> with the cursor over an endpoint of a line or arc, kicad will use that
> endpoint as the reference anchor to move the object around.
>
> Thanks,
> Jose
>
> On Sun, Nov 19, 2017 at 3:05 PM, <d.b2@xxxxxx> wrote:
>
>> The changes introduced in #931a1ccaff, that bring new features to
>> copy/paste in pcbnew, change the behaviour of the cursor snapping when
>> moving footprints:
>> Before you could move components by either their origin or any pad. This
>> is a really handy feature that allows the easy alignment of differently
>> pitched components without the need to constantly change the grid (And I
>> don't seem to be the only one who enjoyed this feature:
>> https://electronics.stackexchange.com/a/214072).
>>
>>
>> Changing line 455 of pcbnew/tools/edit_tool.cpp from
>>         > if ( selection.HasReferencePoint() )
>> to
>>         > if ( false && selection.HasReferencePoint() )
>>
>> brings back the old behaviour (but breaks of course other things as
>> that's just a quick hack). So I prosume it would be quite easy to re-enable
>> this behaviour, maybe by adding an additional check prior to the query of
>> selection.HasReferencePoint() to see if the cursor is currently above a
>> movable pad.
>>
>>
>>
>> Looking forward to discuss this issue with you guys :)
>>
>> Best regards
>> Daniel
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp
index bb6fe3f80..f8ff9ce32 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 );
                     }
 

Follow ups

References