I want to know when the zoom_changed Google Maps event is fired specifically when interacting with the +/- buttons. If I use a regular event listener for zoom_changed, I cannot determine if this is an event created by the user or a zoom caused by something like fitBounds (). Look for the best way to do this.
I tried the following things: none of them work:
1) I looked at the event information on zoom_changed. It seems not.
2) Add mouse and mouse listeners that allow me to set a flag to see if the user is within the borders of the map and check the flag for zoom_changed. This does not work because the map does not consider the zoom buttons as part of the map frame (in other words, hovering of the zoom buttons fires the mouseout event).
3) Add a regular (non-gMap) listener to the zoom buttons. However, I cannot find the final CSS selector that will allow me to capture only buttons.
4) Looked at a function in the gMaps API that allowed me to do something like getZoomElements (), and then I could set the listeners using this.
It is strange that I can clearly do what I want by adding a user control to the map. It seems very strange that they would make me do this, instead of catching on the default zoom settings.
source share