Move ol.ZOOMSLIDER_ANIMATION_DURATION const to a constructor option
This commit is contained in:
@@ -1435,6 +1435,7 @@ olx.control.ZoomOptions.prototype.target;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{className: (string|undefined),
|
* @typedef {{className: (string|undefined),
|
||||||
|
* duration: (number|undefined),
|
||||||
* maxResolution: (number|undefined),
|
* maxResolution: (number|undefined),
|
||||||
* minResolution: (number|undefined),
|
* minResolution: (number|undefined),
|
||||||
* render: (function(ol.MapEvent)|undefined)}}
|
* render: (function(ol.MapEvent)|undefined)}}
|
||||||
@@ -1451,6 +1452,14 @@ olx.control.ZoomSliderOptions;
|
|||||||
olx.control.ZoomSliderOptions.prototype.className;
|
olx.control.ZoomSliderOptions.prototype.className;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation duration in milliseconds. Default is `200`.
|
||||||
|
* @type {number|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.control.ZoomSliderOptions.prototype.duration;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum resolution.
|
* Maximum resolution.
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ goog.require('goog.fx.Dragger.EventType');
|
|||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
goog.require('goog.math.Rect');
|
goog.require('goog.math.Rect');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol');
|
|
||||||
goog.require('ol.Size');
|
goog.require('ol.Size');
|
||||||
goog.require('ol.ViewHint');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.animation');
|
goog.require('ol.animation');
|
||||||
@@ -73,6 +72,12 @@ ol.control.ZoomSlider = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.sliderInitialized_ = false;
|
this.sliderInitialized_ = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
this.duration_ = goog.isDef(options.duration) ? options.duration : 200;
|
||||||
|
|
||||||
var className = goog.isDef(options.className) ?
|
var className = goog.isDef(options.className) ?
|
||||||
options.className : 'ol-zoomslider';
|
options.className : 'ol-zoomslider';
|
||||||
var thumbElement = goog.dom.createDom(goog.dom.TagName.DIV,
|
var thumbElement = goog.dom.createDom(goog.dom.TagName.DIV,
|
||||||
@@ -203,7 +208,7 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) {
|
|||||||
'currentResolution should be defined');
|
'currentResolution should be defined');
|
||||||
map.beforeRender(ol.animation.zoom({
|
map.beforeRender(ol.animation.zoom({
|
||||||
resolution: currentResolution,
|
resolution: currentResolution,
|
||||||
duration: ol.ZOOMSLIDER_ANIMATION_DURATION,
|
duration: this.duration_,
|
||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
}));
|
}));
|
||||||
var relativePosition = this.getRelativePosition_(
|
var relativePosition = this.getRelativePosition_(
|
||||||
@@ -250,7 +255,7 @@ ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
|||||||
'this.currentResolution_ should be defined');
|
'this.currentResolution_ should be defined');
|
||||||
map.beforeRender(ol.animation.zoom({
|
map.beforeRender(ol.animation.zoom({
|
||||||
resolution: this.currentResolution_,
|
resolution: this.currentResolution_,
|
||||||
duration: ol.ZOOMSLIDER_ANIMATION_DURATION,
|
duration: this.duration_,
|
||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
}));
|
}));
|
||||||
var resolution = view.constrainResolution(this.currentResolution_);
|
var resolution = view.constrainResolution(this.currentResolution_);
|
||||||
|
|||||||
@@ -239,12 +239,6 @@ ol.WEBGL_MAX_TEXTURE_SIZE; // value is set in `ol.has`
|
|||||||
ol.WEBGL_EXTENSIONS; // value is set in `ol.has`
|
ol.WEBGL_EXTENSIONS; // value is set in `ol.has`
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @define {number} Zoom slider animation duration.
|
|
||||||
*/
|
|
||||||
ol.ZOOMSLIDER_ANIMATION_DURATION = 200;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inherit the prototype methods from one constructor into another.
|
* Inherit the prototype methods from one constructor into another.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user