我没有找到Openlayers 3导航历史控件。
如何像在OpenLayers 2导航历史中那样使用OpenLayers 3视图历史记录?
发布于 2015-10-02 17:13:36
我在实现它时遇到了一些问题。这就是对我有效的..。
var history = [];
var history_now = -1;
var click = false;
var delay = 350; // OpenLayers render delay = 250
// On view change
map.on('moveend', function (e) {
// Do not save view history if previous/next was clicked
if (click) return;
history.push({
center: map.getView().getCenter(),
resolution: map.getView().getResolution()
});
history_now++;
});
// On previous button click
$('.action-nav-previous').on('click', function () {
if (history_now > 0) {
click = true;
history_now--;
map.getView().setCenter(history[history_now].center);
map.getView().setResolution(history[history_now].resolution);
setTimeout(function () {
click = false;
}, delay);
}
});
// On next button click...发布于 2015-09-07 20:50:34
侦听视图上的更改事件,并在应用程序代码中实现它。
https://stackoverflow.com/questions/32438519
复制相似问题