Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
缩放时,地图会调用 zoomstart、zoom 和 zoomend 事件。有没有办法判断地图是否放大了我们?真的在 zoomend,我需要了解地图是否被放大了。
下面的代码完成了这个...
var currentZoomLevel; map.events.add('zoomstart', layer, function (e) { currentZoomLevel = map.getCamera().zoom; }) map.events.add('zoomend', layer, function (e) { if (currentZoomLevel > map.getCamera().zoom) { // zoomed out } })