Support anchor for resolution animations

This commit is contained in:
Tim Schaub
2016-11-05 20:41:40 -06:00
parent 8529a74063
commit c95aa39dde
3 changed files with 23 additions and 24 deletions

View File

@@ -208,26 +208,20 @@ ol.interaction.Interaction.zoomWithoutConstraints = function(map, view, resoluti
var currentResolution = view.getResolution();
var currentCenter = view.getCenter();
if (currentResolution !== undefined && currentCenter &&
resolution !== currentResolution &&
opt_duration && opt_duration > 0) {
map.beforeRender(ol.animation.zoom({
resolution: currentResolution,
resolution !== currentResolution && opt_duration) {
view.animate({
resolution: resolution,
anchor: opt_anchor,
duration: opt_duration,
easing: ol.easing.easeOut
}));
});
} else {
if (opt_anchor) {
map.beforeRender(ol.animation.pan({
source: currentCenter,
duration: opt_duration,
easing: ol.easing.easeOut
}));
var center = view.calculateCenterZoom(resolution, opt_anchor);
view.setCenter(center);
}
view.setResolution(resolution);
}
if (opt_anchor) {
var center = view.calculateCenterZoom(resolution, opt_anchor);
view.setCenter(center);
}
view.setResolution(resolution);
}
};