It's easy to accidentally move whole zones (or lines, etc...) when you intend to move only one point

Bug #1483915 reported by Henrik Nyberg
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Unassigned

Bug Description

Application: kicad
Version: (2015-08-11 BZR 6084)-product release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.3,wx containers,compatible with 2.8)
Platform: Linux 4.0.0-2-amd64 x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=OFF
         KICAD_SCRIPTING_MODULES=OFF
         KICAD_SCRIPTING_WXPYTHON=OFF
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

When a copper zone is selected and the mouse cursor approaches a zone corner, the crosshair nicely snaps to the corner. However, if you then attempt to drag the point by clicking the left mouse button, and moving the mouse, you often end up moving the whole zone instead of the point as you intended, if you move the mouse cursor a little too early, or too quickly.

The reason for this is that a drag event is only initiated after a certain time has passed after clicking a mouse button, or a certain distance has been traveled by the mouse. In the meantime, more mouse motion events are produced. These mouse motion events causes the point editing tool to update the point currently being edited, and since the mouse cursor has moved, it is no longer close enough to a zone corner when the actual drag event is received, resulting in the whole zone being moved instead of the corner (which the crosshair had nicely snapped to).

This issue affects all kinds of objects edited by the point editor, not only zones.

I have made an attempt at solving this issue in the attached patch.

The patch solves this problem by checking whether a point is located at the DragOrigin at the time of the drag event. I created separate function for updating the currently edited point, which looks for points at the event position for motion events, and at the drag origin for drag events. The function is not called after a drag has been initiated in the point tool.

With this patch, the corner which the crosshair has snapped to will always be moved, no matter how fast you move the mouse after pressing the left mouse button.

Revision history for this message
Henrik Nyberg (henrik-mysko) wrote :
Revision history for this message
Henrik Nyberg (henrik-mysko) wrote :

v2: Added spaces between parentheses in function declaration&definition.

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

Haven't tried the patch, but assuming it works and the devs working on this section feel it is low-risk, I'd love to see it merged, myself. This *is* quite annoying.

///> Updates which point is being edited.

Henrik: You might want to rephrase that a bit, I find it vague.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Thank you Henirk, I committed your patch in revision 6086.

Changed in kicad:
status: New → Fix Committed
Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.