[英]How to get the 'end' resolution after an animation in OL3?
使用OpenLayers 3.20 ,當ol.View
上的動畫進度時,會多次觸發change:resolution
事件。 在該版本之前,它曾經只被觸發過一次。 change:center
也是如此change:center
。
我的問題是:有沒有辦法知道動畫何時開始(這將是我想綁定某種事件監聽器的鈎子)並從那里得到動畫結束時的分辨率? 基本上,我想知道是否有可能在3.20之前獲得先前的行為。
是的,如果您正在使用ol.View#animate
,則有一種方法 - 在動畫結束時使用回調:
map.getView().animate({
center: ol.proj.fromLonLat([37.6178, 55.7517]),
zoom: 5
}, animateCallback);
function animateCallback (complete) {
if (complete) {
console.log(map.getView().getResolution());
console.log(map.getView().getZoom());
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.