admin管理员组文章数量:1221302
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?
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?
Share Improve this question edited Apr 8, 2012 at 6:10 Engineer 48.8k12 gold badges90 silver badges92 bronze badges asked Mar 22, 2012 at 7:32 3D-kreativ3D-kreativ 9,29737 gold badges105 silver badges162 bronze badges 2 |2 Answers
Reset to default 16Yes, 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;
});
本文标签: javascriptPan event for Google MapsStack Overflow
版权声明:本文标题:javascript - Pan event for Google Maps? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739301980a2157182.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
idle
event can resolve your problem. Check here: developers.google.com/maps/documentation/javascript/… – Engineer Commented Mar 22, 2012 at 8:17