[OpenLayers-Dev] DragPan issue
Christopher Schmidt
crschmidt at metacarta.com
Fri Aug 10 08:54:43 EDT 2007
On Fri, Aug 10, 2007 at 02:43:53PM +0200, Eric Lemoine wrote:
> 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?
http://trac.openlayers.org/ticket/774
I'm waiting for Ti'ms feedback on this.
-- Chris
> 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
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
--
Christopher Schmidt
MetaCarta
More information about the Dev
mailing list