Hi all
DragPan control does setCenter() even if the mouse pointer hasen't
changed position between mousedown and mouseup. Among other things,
this means a moveend event is triggered on each map click. That
doesn't make much sense to me. What do you think about the attached
patch?
PS: if we agree there's a bug, I'll go ahead and open ticket, with a
patch including tests obviously ;-)
Thanks,
--
Eric
Index: DragPan.js
===================================================================
--- DragPan.js (revision 1229)
+++ DragPan.js (working copy)
@@ -58,11 +58,13 @@
panMapDone: function (xy) {
var deltaX = this.handler.start.x - xy.x;
var deltaY = this.handler.start.y - xy.y;
- var size = this.map.getSize();
- var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
- size.h / 2 + deltaY);
- var newCenter = this.map.getLonLatFromViewPortPx( newXY );
- this.map.setCenter(newCenter, null, false);
+ if (deltaX != 0 && deltaY != 0) {
+ var size = this.map.getSize();
+ var newXY = new OpenLayers.Pixel(size.w / 2 + deltaX,
+ size.h / 2 + deltaY);
+ var newCenter = this.map.getLonLatFromViewPortPx( newXY );
+ this.map.setCenter(newCenter, null, false);
+ }
// this assumes xy won't be changed inside Handler.Drag
// a safe bet for now, and saves us the extra call to clone().
this.handler.start = xy;
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev