[OpenLayers-Users] fire an event only once on either zoomend or moveend

Atle Frenvik Sveen atle.sveen at bouvet.no
Tue Feb 7 02:01:31 EST 2012


Hello!

Although the OpenLayers documentation gets a lot of critisicm, I think it is quite clear in this aspect: 

http://dev.openlayers.org/releases/OpenLayers-2.11/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.EVENT_TYPES

"moveend: triggered after a drag, pan, or zoom completes"

So, register for the moveend-event only, and you should be good to go. 

(So can others discuss how intuitive the name "moveend" is for the case of both zoom,drag and pan)

-Atle Sveen

-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Puneet Kishor
Sent: 7. februar 2012 05:43
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] fire an event only once on either zoomend or moveend

I want to have an event fire only once on zoomend or on moveend.

If I do

	"eventListeners": {
                    "zoomend": mapEvent
                }

it fires only when I zoom in or out. On the other hand, if I do

	"eventListeners": {
		    "moveend": mapEvent,
                    "zoomend": mapEvent
                }


then while it fires only once on panning the map, it fires twice on zoom in or out. How can I make it so it fires only once whether it is moveend or zoomend?

--
Puneet Kishor _______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list