-1

开始拖动、平移或缩放后触发的 Map 事件是什么?在 API V2 中它是 movestart(当地图视图开始更改时会触发此事件)但 V3 没有此事件,所以我想知道 V3 中“movestart”事件的等价物是什么?

4

3 回答 3

2

查看可用的google.maps.Map 事件。拖动有一个dragstart;对于平移或缩放,看起来只有在它们更改时触发的事件。

  • 拖动启动
  • 拖动端
  • center_changed
  • zoom_changed
于 2013-09-16T12:40:52.223 回答
1

在您拥有的地图上dragstart。您还有zoom_changed,bounds_changedcenter_changed等事件projection_changed

https://developers.google.com/maps/documentation/javascript/reference?csw=1#Map

于 2013-09-16T12:41:43.830 回答
0

V3 中没有等价物。但是你可以通过观察bounds_changed-event 来实现它:

        google.maps.event.addListener(map, 'idle', function(){
          google.maps.event.addListenerOnce(this, 'bounds_changed', function(){
             google.maps.event.trigger(this,'movestart');});});

        //test the event 
        google.maps.event.addListener(map, 'movestart',function(){
              console.log('movestart triggered')});     
于 2013-09-16T12:54:19.513 回答