Google Map API V3.0 - 如何检测MapTypeId变更 [英] Google Map API V3.0 - How to Detect MapTypeId Change
本文介绍了Google Map API V3.0 - 如何检测MapTypeId变更的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
添加侦听器以检测缩放更改可以使用以下内容:
google.maps.event.addListener(map ,'zoom_changed',function())
检测地图类型变化的代码是什么从 ROADMAP
到另一个视图,如
SATELLITE
?我可以得到这个值:
val myMapType = map.getMapTypeId();
但不知道如何检测视图中的变化。
我正在使用Google Map API V3.0
解决方案
它出来:
pre $ google.maps.event.addListener(map,'maptypeid_changed',function(){
document .getElementById(maptype).value = map.getMapTypeId();
});
To add a listener to detect a zoom change works with the following:
google.maps.event.addListener(map,'zoom_changed',function())
What is the code to detect a change in the map type from ROADMAP
to another view like
SATELLITE
? I can get the value:
val myMapType = map.getMapTypeId();
but do not know how to detect the change in view.
I am using the Google Map API V3.0
解决方案
OK worked it out:
google.maps.event.addListener( map, 'maptypeid_changed', function() {
document.getElementById( "maptype" ).value = map.getMapTypeId();
} );
这篇关于Google Map API V3.0 - 如何检测MapTypeId变更的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文