views:

151

answers:

2

Hello all. I am using google maps + javascript + php in my application. I want to know two things:
In google maps,

  1. does moveend event ALWAYS gets fired AFTER zoomend/dragend (whichever of two) event occurs.

  2. When I click zoom icon on google map or scroll the mouse wheel to zoom, the zoomend event gets fired more than once. If I zoom in one step using + icon on map, the zoomend event gets fired twice or sometimes more. any possible loophole.

    And so want to know how to stop further event propogation in javascript. (remember I need not use clearListeners as it will forever ignore event handler which is undesirable).

Thank you.

+1  A: 

Hi

you could try just reuturning false or null from the event. If that doesn't work trying using "event.cancelBubble = true" or "event.stopPropagation"

TAkinremi
Use both cancelBubble and stopPropagation(), because some browsers will need the former and some the latter.
Marcel Korpel
Thank you for reply.
Prashant
+1  A: 

I set up listeners for 'moveend', 'zoomend', and 'dragend' to try it out.

GEvent.addListener(map, "moveend", function() { console.log('moveend'); });
GEvent.addListener(map, "zoomend", function() { console.log('zoomend'); });
GEvent.addListener(map, "dragend", function() { console.log('dragend'); });

It appears that 'moveend' always fires after 'zoomend' or 'dragend'.

However, no events ever fired more than once at a time. Maybe you accidentally set up two simultaneous listeners. You shouldn't need to use stopPropagation or cancelBubble.

Chris B
I understand. Thank you for response.
Prashant