Use view.animate() on zoom slider drag end

This commit is contained in:
Tim Schaub
2016-11-06 08:09:53 -07:00
parent e13d3f6d2b
commit e447df39f7
+6 -8
View File
@@ -4,7 +4,6 @@ goog.provide('ol.control.ZoomSlider');
goog.require('ol'); goog.require('ol');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.css'); goog.require('ol.css');
goog.require('ol.easing'); goog.require('ol.easing');
@@ -306,16 +305,15 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
*/ */
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) { ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
if (this.dragging_) { if (this.dragging_) {
var map = this.getMap(); var view = this.getMap().getView();
var view = map.getView();
view.setHint(ol.View.Hint.INTERACTING, -1); view.setHint(ol.View.Hint.INTERACTING, -1);
map.beforeRender(ol.animation.zoom({
resolution: /** @type {number} */ (this.currentResolution_), view.animate({
resolution: view.constrainResolution(this.currentResolution_),
duration: this.duration_, duration: this.duration_,
easing: ol.easing.easeOut easing: ol.easing.easeOut
})); });
var resolution = view.constrainResolution(this.currentResolution_);
view.setResolution(resolution);
this.dragging_ = false; this.dragging_ = false;
this.previousX_ = undefined; this.previousX_ = undefined;
this.previousY_ = undefined; this.previousY_ = undefined;