Private enum for zoom slider direction
This commit is contained in:
@@ -42,12 +42,12 @@ ol.control.ZoomSlider = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The direction of the slider. Will be determined from actual display of the
|
* The direction of the slider. Will be determined from actual display of the
|
||||||
* container and defaults to ol.control.ZoomSlider.direction.VERTICAL.
|
* container and defaults to ol.control.ZoomSlider.Direction_.VERTICAL.
|
||||||
*
|
*
|
||||||
* @type {ol.control.ZoomSlider.direction}
|
* @type {ol.control.ZoomSlider.Direction_}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.direction_ = ol.control.ZoomSlider.direction.VERTICAL;
|
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -154,8 +154,9 @@ ol.control.ZoomSlider.prototype.disposeInternal = function() {
|
|||||||
* The enum for available directions.
|
* The enum for available directions.
|
||||||
*
|
*
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.direction = {
|
ol.control.ZoomSlider.Direction_ = {
|
||||||
VERTICAL: 0,
|
VERTICAL: 0,
|
||||||
HORIZONTAL: 1
|
HORIZONTAL: 1
|
||||||
};
|
};
|
||||||
@@ -196,10 +197,10 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
|||||||
this.thumbSize_ = [thumbWidth, thumbHeight];
|
this.thumbSize_ = [thumbWidth, thumbHeight];
|
||||||
|
|
||||||
if (containerSize.width > containerSize.height) {
|
if (containerSize.width > containerSize.height) {
|
||||||
this.direction_ = ol.control.ZoomSlider.direction.HORIZONTAL;
|
this.direction_ = ol.control.ZoomSlider.Direction_.HORIZONTAL;
|
||||||
this.widthLimit_ = containerSize.width - thumbWidth;
|
this.widthLimit_ = containerSize.width - thumbWidth;
|
||||||
} else {
|
} else {
|
||||||
this.direction_ = ol.control.ZoomSlider.direction.VERTICAL;
|
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
|
||||||
this.heightLimit_ = containerSize.height - thumbHeight;
|
this.heightLimit_ = containerSize.height - thumbHeight;
|
||||||
}
|
}
|
||||||
this.sliderInitialized_ = true;
|
this.sliderInitialized_ = true;
|
||||||
@@ -333,7 +334,7 @@ ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
|||||||
var position = this.getPositionForResolution_(res);
|
var position = this.getPositionForResolution_(res);
|
||||||
var thumb = this.element.firstElementChild;
|
var thumb = this.element.firstElementChild;
|
||||||
|
|
||||||
if (this.direction_ == ol.control.ZoomSlider.direction.HORIZONTAL) {
|
if (this.direction_ == ol.control.ZoomSlider.Direction_.HORIZONTAL) {
|
||||||
thumb.style.left = this.widthLimit_ * position + 'px';
|
thumb.style.left = this.widthLimit_ * position + 'px';
|
||||||
} else {
|
} else {
|
||||||
thumb.style.top = this.heightLimit_ * position + 'px';
|
thumb.style.top = this.heightLimit_ * position + 'px';
|
||||||
@@ -353,7 +354,7 @@ ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
|||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
||||||
var amount;
|
var amount;
|
||||||
if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) {
|
if (this.direction_ === ol.control.ZoomSlider.Direction_.HORIZONTAL) {
|
||||||
amount = x / this.widthLimit_;
|
amount = x / this.widthLimit_;
|
||||||
} else {
|
} else {
|
||||||
amount = y / this.heightLimit_;
|
amount = y / this.heightLimit_;
|
||||||
|
|||||||
Reference in New Issue
Block a user