Ticket #1466 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

Drag.js reports done, even if the user only clicked, but did not move

Reported by: openlayers Owned by:
Priority: minor Milestone: 2.7 Release
Component: Handler.Drag Version: 2.5
Keywords: Cc:
State: Complete

Description

Trying to implement a draggable iconic marker, I notice that the marker moves even if I just click into it. The marker has an icon of size 25x25px, so when I click somewhere within it, the marker/icon is slightly moved depending on where I click within the marker.

This can certainly be rectified by somehow fixing the offset of the icon during the move, but according to the comments in Drag.js, the click should not look like a move.

Change History

Changed 5 years ago by openlayers

This seems to fix it

*** Drag.js~	2007-10-09 19:45:37.000000000 +0200
--- Drag.js	2008-03-29 20:47:24.000000000 +0100
***************
*** 213,219 ****
              this.map.div.style.cursor = "";
              this.up(evt);
              this.callback("up", [evt.xy]);
!             this.callback("done", [evt.xy]);
              document.onselectstart = this.oldOnselectstart;
          }
          return true;
--- 213,219 ----
              this.map.div.style.cursor = "";
              this.up(evt);
              this.callback("up", [evt.xy]);
!             if( this.start!=this.last ) this.callback("done", [evt.xy]);
              document.onselectstart = this.oldOnselectstart;
          }
          return true;


Yes, I seriously consider to check out from subversion to create decent patches:-)

Harald Kirsch

Changed 5 years ago by crschmidt

I believe this is already fixed in trunk.

If you are using a hosted version of OpenLayers, changing your page to use  http://dev.openlayers.org/nightly/OpenLayers.js will use a nightly build, against which you can test if this is already fixed.

Your patch seems to be in the mouseup function, which now says:

    if(dragged) {
                this.callback("done", [evt.xy]);
            }

Which is why I think this is already fixed.

Changed 5 years ago by crschmidt

  • state set to Awaiting User Feedback
  • milestone set to 2.7 Release

Changed 5 years ago by pifpafpuf

I'll check out from subversion and check. May take two days before I find the time.

Changed 5 years ago by crschmidt

Given the title of #1118 (the ticket in which it was added) checking is probably unnecessary at this point :) But it does mean that when you get new code, you will have the issue fixed.

Changed 5 years ago by pifpafpuf

Anyway I am used to check my bugs explicitly, if possible. I did, and it works now with revision 6781. Thanks.

(I assume I am not the one to set this to resolved/fixed.) Harald.

Changed 5 years ago by crschmidt

  • status changed from new to closed
  • state changed from Awaiting User Feedback to Complete
  • resolution set to fixed

Thanks for checking! Closing.

Changed 5 years ago by euzuro

  • component changed from general to Handler.Drag
Note: See TracTickets for help on using tickets.