There are some event listeners like mouseover, mouseout and click to use on the Google Map, but is there an event that respond when a user pan or zoom the map?
EDIT:
I used the 'center_changed', but this didn't work the way I was hoping! If I move the mouse above the map and then pan the map the event is acitvated, but the event is activated all the time, even when I'm not use pan, just move the mouse cursor on the map. The mouse cursor is a fist, not a hand, all the time!? What is wrong?
Yes, there are.
pan -> 'center_changed'
zoom -> 'zoom_changed'
You can use the mousedown and mouseup events to keep track of whether the mouse is being used to pan the map. If the mouse is not down, then a center_changed event originates from the user clicking the pan button:
//only reload on center_changed if the mouse is not down. This is equivalent to panning
this.addListener("center_changed", function() {
if (!this.mouseDown) {
//user has clicked the pan button
}
});
this.addListener("mouseup", function() {
this.mouseDown = false;
});
this.addListener("mousedown", function() {
this.mouseDown = true;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With