加载或单击Google地图时如何找到当前的缩放级别?
Answers:
如果您有这样的地图对象:
var mapObject = new google.maps.Map(document.getElementById("map"), _mapOptions);
使用
mapObject.getZoom();
map.getCameraPosition().zoom
使用此代码:
float zoomlevel = mMap.getCameraPosition().zoom;
如果您需要放大变更
google.maps.event.addListener(map, 'zoom_changed', function() {
var zoom = map.getZoom();
console.log(zoom);
});
我用它得到的:
console.log(this.map.zoom);
的HTML:
<agm-map (mapReady)="onMapReady($event)">
TS:
onMapReady(map) {
this.map = map;
}
Map.getZoom()
?