Transformed
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* @module ol/control/Attribution
|
||||
*/
|
||||
// FIXME handle date line wrap
|
||||
|
||||
goog.provide('ol.control.Attribution');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.layer.Layer');
|
||||
goog.require('ol.obj');
|
||||
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_dom_ from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_layer_Layer_ from '../layer/Layer.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -25,7 +25,7 @@ goog.require('ol.obj');
|
||||
* @param {olx.control.AttributionOptions=} opt_options Attribution options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution = function(opt_options) {
|
||||
var _ol_control_Attribution_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -99,10 +99,10 @@ ol.control.Attribution = function(opt_options) {
|
||||
button.title = tipLabel;
|
||||
button.appendChild(activeLabel);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK, this.handleClick_, this);
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK, this.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL +
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL +
|
||||
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
|
||||
(this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = document.createElement('div');
|
||||
@@ -110,9 +110,9 @@ ol.control.Attribution = function(opt_options) {
|
||||
element.appendChild(this.ulElement_);
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.Attribution.render;
|
||||
var render = options.render ? options.render : _ol_control_Attribution_.render;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -138,7 +138,8 @@ ol.control.Attribution = function(opt_options) {
|
||||
this.logoElements_ = {};
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.Attribution, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_Attribution_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -147,7 +148,7 @@ ol.inherits(ol.control.Attribution, ol.control.Control);
|
||||
* @return {Array.<string>} Attributions.
|
||||
* @private
|
||||
*/
|
||||
ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
|
||||
_ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) {
|
||||
/**
|
||||
* Used to determine if an attribution already exists.
|
||||
* @type {Object.<string, boolean>}
|
||||
@@ -164,7 +165,7 @@ ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
|
||||
var resolution = frameState.viewState.resolution;
|
||||
for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
|
||||
var layerState = layerStatesArray[i];
|
||||
if (!ol.layer.Layer.visibleAtResolution(layerState, resolution)) {
|
||||
if (!_ol_layer_Layer_.visibleAtResolution(layerState, resolution)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
|
||||
* @this {ol.control.Attribution}
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.render = function(mapEvent) {
|
||||
_ol_control_Attribution_.render = function(mapEvent) {
|
||||
this.updateElement_(mapEvent.frameState);
|
||||
};
|
||||
|
||||
@@ -216,7 +217,7 @@ ol.control.Attribution.render = function(mapEvent) {
|
||||
* @private
|
||||
* @param {?olx.FrameState} frameState Frame state.
|
||||
*/
|
||||
ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
_ol_control_Attribution_.prototype.updateElement_ = function(frameState) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
this.element.style.display = 'none';
|
||||
@@ -226,7 +227,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
}
|
||||
|
||||
var attributions = this.getSourceAttributions_(frameState);
|
||||
if (ol.array.equals(attributions, this.renderedAttributions_)) {
|
||||
if (_ol_array_.equals(attributions, this.renderedAttributions_)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -249,7 +250,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
this.element.classList.remove('ol-logo-only');
|
||||
}
|
||||
|
||||
var visible = attributions.length > 0 || !ol.obj.isEmpty(frameState.logos);
|
||||
var visible = attributions.length > 0 || !_ol_obj_.isEmpty(frameState.logos);
|
||||
if (this.renderedVisible_ != visible) {
|
||||
this.element.style.display = visible ? '' : 'none';
|
||||
this.renderedVisible_ = visible;
|
||||
@@ -264,7 +265,7 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
* @param {?olx.FrameState} frameState Frame state.
|
||||
* @private
|
||||
*/
|
||||
ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
_ol_control_Attribution_.prototype.insertLogos_ = function(frameState) {
|
||||
|
||||
var logo;
|
||||
var logos = frameState.logos;
|
||||
@@ -272,7 +273,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
|
||||
for (logo in logoElements) {
|
||||
if (!(logo in logos)) {
|
||||
ol.dom.removeNode(logoElements[logo]);
|
||||
_ol_dom_.removeNode(logoElements[logo]);
|
||||
delete logoElements[logo];
|
||||
}
|
||||
}
|
||||
@@ -299,7 +300,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
}
|
||||
}
|
||||
|
||||
this.logoLi_.style.display = !ol.obj.isEmpty(logos) ? '' : 'none';
|
||||
this.logoLi_.style.display = !_ol_obj_.isEmpty(logos) ? '' : 'none';
|
||||
|
||||
};
|
||||
|
||||
@@ -308,7 +309,7 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Attribution.prototype.handleClick_ = function(event) {
|
||||
_ol_control_Attribution_.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
};
|
||||
@@ -317,12 +318,12 @@ ol.control.Attribution.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.Attribution.prototype.handleToggle_ = function() {
|
||||
_ol_control_Attribution_.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
ol.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
_ol_dom_.replaceNode(this.collapseLabel_, this.label_);
|
||||
} else {
|
||||
ol.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
_ol_dom_.replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
};
|
||||
@@ -333,7 +334,7 @@ ol.control.Attribution.prototype.handleToggle_ = function() {
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.getCollapsible = function() {
|
||||
_ol_control_Attribution_.prototype.getCollapsible = function() {
|
||||
return this.collapsible_;
|
||||
};
|
||||
|
||||
@@ -343,7 +344,7 @@ ol.control.Attribution.prototype.getCollapsible = function() {
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
|
||||
_ol_control_Attribution_.prototype.setCollapsible = function(collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
@@ -362,7 +363,7 @@ ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
|
||||
_ol_control_Attribution_.prototype.setCollapsed = function(collapsed) {
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
@@ -376,6 +377,7 @@ ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
|
||||
* @return {boolean} True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Attribution.prototype.getCollapsed = function() {
|
||||
_ol_control_Attribution_.prototype.getCollapsed = function() {
|
||||
return this.collapsed_;
|
||||
};
|
||||
export default _ol_control_Attribution_;
|
||||
|
||||
+25
-23
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.control.Control');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.events');
|
||||
|
||||
/**
|
||||
* @module ol/control/Control
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_MapEventType_ from '../MapEventType.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_dom_ from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -36,9 +36,9 @@ goog.require('ol.events');
|
||||
* @param {olx.control.ControlOptions} options Control options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Control = function(options) {
|
||||
var _ol_control_Control_ = function(options) {
|
||||
|
||||
ol.Object.call(this);
|
||||
_ol_Object_.call(this);
|
||||
|
||||
/**
|
||||
* @protected
|
||||
@@ -67,22 +67,23 @@ ol.control.Control = function(options) {
|
||||
/**
|
||||
* @type {function(ol.MapEvent)}
|
||||
*/
|
||||
this.render = options.render ? options.render : ol.nullFunction;
|
||||
this.render = options.render ? options.render : _ol_.nullFunction;
|
||||
|
||||
if (options.target) {
|
||||
this.setTarget(options.target);
|
||||
}
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.Control, ol.Object);
|
||||
|
||||
_ol_.inherits(_ol_control_Control_, _ol_Object_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.Control.prototype.disposeInternal = function() {
|
||||
ol.dom.removeNode(this.element);
|
||||
ol.Object.prototype.disposeInternal.call(this);
|
||||
_ol_control_Control_.prototype.disposeInternal = function() {
|
||||
_ol_dom_.removeNode(this.element);
|
||||
_ol_Object_.prototype.disposeInternal.call(this);
|
||||
};
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ ol.control.Control.prototype.disposeInternal = function() {
|
||||
* @return {ol.PluggableMap} Map.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Control.prototype.getMap = function() {
|
||||
_ol_control_Control_.prototype.getMap = function() {
|
||||
return this.map_;
|
||||
};
|
||||
|
||||
@@ -104,12 +105,12 @@ ol.control.Control.prototype.getMap = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.control.Control.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap = function(map) {
|
||||
if (this.map_) {
|
||||
ol.dom.removeNode(this.element);
|
||||
_ol_dom_.removeNode(this.element);
|
||||
}
|
||||
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
|
||||
ol.events.unlistenByKey(this.listenerKeys[i]);
|
||||
_ol_events_.unlistenByKey(this.listenerKeys[i]);
|
||||
}
|
||||
this.listenerKeys.length = 0;
|
||||
this.map_ = map;
|
||||
@@ -117,9 +118,9 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
var target = this.target_ ?
|
||||
this.target_ : map.getOverlayContainerStopEvent();
|
||||
target.appendChild(this.element);
|
||||
if (this.render !== ol.nullFunction) {
|
||||
this.listenerKeys.push(ol.events.listen(map,
|
||||
ol.MapEventType.POSTRENDER, this.render, this));
|
||||
if (this.render !== _ol_.nullFunction) {
|
||||
this.listenerKeys.push(_ol_events_.listen(map,
|
||||
_ol_MapEventType_.POSTRENDER, this.render, this));
|
||||
}
|
||||
map.render();
|
||||
}
|
||||
@@ -135,8 +136,9 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
* @param {Element|string} target Target.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Control.prototype.setTarget = function(target) {
|
||||
_ol_control_Control_.prototype.setTarget = function(target) {
|
||||
this.target_ = typeof target === 'string' ?
|
||||
document.getElementById(target) :
|
||||
target;
|
||||
};
|
||||
export default _ol_control_Control_;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.control.FullScreen');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
|
||||
/**
|
||||
* @module ol/control/FullScreen
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_dom_ from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -25,7 +25,7 @@ goog.require('ol.events.EventType');
|
||||
* @param {olx.control.FullScreenOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.FullScreen = function(opt_options) {
|
||||
var _ol_control_FullScreen_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -56,22 +56,22 @@ ol.control.FullScreen = function(opt_options) {
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
||||
var button = document.createElement('button');
|
||||
button.className = this.cssClassName_ + '-' + ol.control.FullScreen.isFullScreen();
|
||||
button.className = this.cssClassName_ + '-' + _ol_control_FullScreen_.isFullScreen();
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.labelNode_);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
|
||||
' ' + ol.css.CLASS_CONTROL + ' ' +
|
||||
(!ol.control.FullScreen.isFullScreenSupported() ? ol.css.CLASS_UNSUPPORTED : '');
|
||||
var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE +
|
||||
' ' + _ol_css_.CLASS_CONTROL + ' ' +
|
||||
(!_ol_control_FullScreen_.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : '');
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
@@ -89,14 +89,15 @@ ol.control.FullScreen = function(opt_options) {
|
||||
this.source_ = options.source;
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.FullScreen, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_FullScreen_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.prototype.handleClick_ = function(event) {
|
||||
_ol_control_FullScreen_.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleFullScreen_();
|
||||
};
|
||||
@@ -105,16 +106,16 @@ ol.control.FullScreen.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
if (!ol.control.FullScreen.isFullScreenSupported()) {
|
||||
_ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
|
||||
if (!_ol_control_FullScreen_.isFullScreenSupported()) {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
if (ol.control.FullScreen.isFullScreen()) {
|
||||
ol.control.FullScreen.exitFullScreen();
|
||||
if (_ol_control_FullScreen_.isFullScreen()) {
|
||||
_ol_control_FullScreen_.exitFullScreen();
|
||||
} else {
|
||||
var element;
|
||||
if (this.source_) {
|
||||
@@ -125,10 +126,10 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
element = map.getTargetElement();
|
||||
}
|
||||
if (this.keys_) {
|
||||
ol.control.FullScreen.requestFullScreenWithKeys(element);
|
||||
_ol_control_FullScreen_.requestFullScreenWithKeys(element);
|
||||
|
||||
} else {
|
||||
ol.control.FullScreen.requestFullScreen(element);
|
||||
_ol_control_FullScreen_.requestFullScreen(element);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -137,15 +138,15 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
_ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() {
|
||||
var button = this.element.firstElementChild;
|
||||
var map = this.getMap();
|
||||
if (ol.control.FullScreen.isFullScreen()) {
|
||||
if (_ol_control_FullScreen_.isFullScreen()) {
|
||||
button.className = this.cssClassName_ + '-true';
|
||||
ol.dom.replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
_ol_dom_.replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
} else {
|
||||
button.className = this.cssClassName_ + '-false';
|
||||
ol.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
_ol_dom_.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
}
|
||||
if (map) {
|
||||
map.updateSize();
|
||||
@@ -157,11 +158,11 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.control.FullScreen.prototype.setMap = function(map) {
|
||||
ol.control.Control.prototype.setMap.call(this, map);
|
||||
_ol_control_FullScreen_.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
this.listenerKeys.push(ol.events.listen(document,
|
||||
ol.control.FullScreen.getChangeType_(),
|
||||
this.listenerKeys.push(_ol_events_.listen(document,
|
||||
_ol_control_FullScreen_.getChangeType_(),
|
||||
this.handleFullScreenChange_, this)
|
||||
);
|
||||
}
|
||||
@@ -170,7 +171,7 @@ ol.control.FullScreen.prototype.setMap = function(map) {
|
||||
/**
|
||||
* @return {boolean} Fullscreen is supported by the current platform.
|
||||
*/
|
||||
ol.control.FullScreen.isFullScreenSupported = function() {
|
||||
_ol_control_FullScreen_.isFullScreenSupported = function() {
|
||||
var body = document.body;
|
||||
return !!(
|
||||
body.webkitRequestFullscreen ||
|
||||
@@ -183,7 +184,7 @@ ol.control.FullScreen.isFullScreenSupported = function() {
|
||||
/**
|
||||
* @return {boolean} Element is currently in fullscreen.
|
||||
*/
|
||||
ol.control.FullScreen.isFullScreen = function() {
|
||||
_ol_control_FullScreen_.isFullScreen = function() {
|
||||
return !!(
|
||||
document.webkitIsFullScreen || document.mozFullScreen ||
|
||||
document.msFullscreenElement || document.fullscreenElement
|
||||
@@ -194,7 +195,7 @@ ol.control.FullScreen.isFullScreen = function() {
|
||||
* Request to fullscreen an element.
|
||||
* @param {Node} element Element to request fullscreen
|
||||
*/
|
||||
ol.control.FullScreen.requestFullScreen = function(element) {
|
||||
_ol_control_FullScreen_.requestFullScreen = function(element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
@@ -210,20 +211,20 @@ ol.control.FullScreen.requestFullScreen = function(element) {
|
||||
* Request to fullscreen an element with keyboard input.
|
||||
* @param {Node} element Element to request fullscreen
|
||||
*/
|
||||
ol.control.FullScreen.requestFullScreenWithKeys = function(element) {
|
||||
_ol_control_FullScreen_.requestFullScreenWithKeys = function(element) {
|
||||
if (element.mozRequestFullScreenWithKeys) {
|
||||
element.mozRequestFullScreenWithKeys();
|
||||
} else if (element.webkitRequestFullscreen) {
|
||||
element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||
} else {
|
||||
ol.control.FullScreen.requestFullScreen(element);
|
||||
_ol_control_FullScreen_.requestFullScreen(element);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exit fullscreen.
|
||||
*/
|
||||
ol.control.FullScreen.exitFullScreen = function() {
|
||||
_ol_control_FullScreen_.exitFullScreen = function() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
@@ -239,7 +240,7 @@ ol.control.FullScreen.exitFullScreen = function() {
|
||||
* @return {string} Change type.
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.getChangeType_ = (function() {
|
||||
_ol_control_FullScreen_.getChangeType_ = (function() {
|
||||
var changeType;
|
||||
return function() {
|
||||
if (!changeType) {
|
||||
@@ -257,3 +258,4 @@ ol.control.FullScreen.getChangeType_ = (function() {
|
||||
return changeType;
|
||||
};
|
||||
})();
|
||||
export default _ol_control_FullScreen_;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* @module ol/control/MousePosition
|
||||
*/
|
||||
// FIXME should listen on appropriate pane, once it is defined
|
||||
|
||||
goog.provide('ol.control.MousePosition');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.proj');
|
||||
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -23,7 +23,7 @@ goog.require('ol.proj');
|
||||
* options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition = function(opt_options) {
|
||||
var _ol_control_MousePosition_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -31,16 +31,16 @@ ol.control.MousePosition = function(opt_options) {
|
||||
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
|
||||
|
||||
var render = options.render ?
|
||||
options.render : ol.control.MousePosition.render;
|
||||
options.render : _ol_control_MousePosition_.render;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
ol.events.listen(this,
|
||||
ol.Object.getChangeEventType(ol.control.MousePosition.Property_.PROJECTION),
|
||||
_ol_events_.listen(this,
|
||||
_ol_Object_.getChangeEventType(_ol_control_MousePosition_.Property_.PROJECTION),
|
||||
this.handleProjectionChanged_, this);
|
||||
|
||||
if (options.coordinateFormat) {
|
||||
@@ -81,7 +81,8 @@ ol.control.MousePosition = function(opt_options) {
|
||||
this.lastMouseMovePixel_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.MousePosition, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_MousePosition_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,7 +91,7 @@ ol.inherits(ol.control.MousePosition, ol.control.Control);
|
||||
* @this {ol.control.MousePosition}
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.render = function(mapEvent) {
|
||||
_ol_control_MousePosition_.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.mapProjection_ = null;
|
||||
@@ -107,7 +108,7 @@ ol.control.MousePosition.render = function(mapEvent) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
|
||||
_ol_control_MousePosition_.prototype.handleProjectionChanged_ = function() {
|
||||
this.transform_ = null;
|
||||
};
|
||||
|
||||
@@ -120,9 +121,10 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
||||
return /** @type {ol.CoordinateFormatType|undefined} */ (
|
||||
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
|
||||
_ol_control_MousePosition_.prototype.getCoordinateFormat = function() {
|
||||
return (
|
||||
/** @type {ol.CoordinateFormatType|undefined} */ this.get(_ol_control_MousePosition_.Property_.COORDINATE_FORMAT)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -133,9 +135,10 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.prototype.getProjection = function() {
|
||||
return /** @type {ol.proj.Projection|undefined} */ (
|
||||
this.get(ol.control.MousePosition.Property_.PROJECTION));
|
||||
_ol_control_MousePosition_.prototype.getProjection = function() {
|
||||
return (
|
||||
/** @type {ol.proj.Projection|undefined} */ this.get(_ol_control_MousePosition_.Property_.PROJECTION)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +146,7 @@ ol.control.MousePosition.prototype.getProjection = function() {
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.MousePosition.prototype.handleMouseMove = function(event) {
|
||||
_ol_control_MousePosition_.prototype.handleMouseMove = function(event) {
|
||||
var map = this.getMap();
|
||||
this.lastMouseMovePixel_ = map.getEventPixel(event);
|
||||
this.updateHTML_(this.lastMouseMovePixel_);
|
||||
@@ -154,7 +157,7 @@ ol.control.MousePosition.prototype.handleMouseMove = function(event) {
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.MousePosition.prototype.handleMouseOut = function(event) {
|
||||
_ol_control_MousePosition_.prototype.handleMouseOut = function(event) {
|
||||
this.updateHTML_(null);
|
||||
this.lastMouseMovePixel_ = null;
|
||||
};
|
||||
@@ -164,14 +167,14 @@ ol.control.MousePosition.prototype.handleMouseOut = function(event) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.prototype.setMap = function(map) {
|
||||
ol.control.Control.prototype.setMap.call(this, map);
|
||||
_ol_control_MousePosition_.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(
|
||||
ol.events.listen(viewport, ol.events.EventType.MOUSEMOVE,
|
||||
_ol_events_.listen(viewport, _ol_events_EventType_.MOUSEMOVE,
|
||||
this.handleMouseMove, this),
|
||||
ol.events.listen(viewport, ol.events.EventType.MOUSEOUT,
|
||||
_ol_events_.listen(viewport, _ol_events_EventType_.MOUSEOUT,
|
||||
this.handleMouseOut, this)
|
||||
);
|
||||
}
|
||||
@@ -185,8 +188,8 @@ ol.control.MousePosition.prototype.setMap = function(map) {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
|
||||
this.set(ol.control.MousePosition.Property_.COORDINATE_FORMAT, format);
|
||||
_ol_control_MousePosition_.prototype.setCoordinateFormat = function(format) {
|
||||
this.set(_ol_control_MousePosition_.Property_.COORDINATE_FORMAT, format);
|
||||
};
|
||||
|
||||
|
||||
@@ -197,8 +200,8 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||
this.set(ol.control.MousePosition.Property_.PROJECTION, ol.proj.get(projection));
|
||||
_ol_control_MousePosition_.prototype.setProjection = function(projection) {
|
||||
this.set(_ol_control_MousePosition_.Property_.PROJECTION, _ol_proj_.get(projection));
|
||||
};
|
||||
|
||||
|
||||
@@ -206,16 +209,16 @@ ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||
* @param {?ol.Pixel} pixel Pixel.
|
||||
* @private
|
||||
*/
|
||||
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
_ol_control_MousePosition_.prototype.updateHTML_ = function(pixel) {
|
||||
var html = this.undefinedHTML_;
|
||||
if (pixel && this.mapProjection_) {
|
||||
if (!this.transform_) {
|
||||
var projection = this.getProjection();
|
||||
if (projection) {
|
||||
this.transform_ = ol.proj.getTransformFromProjections(
|
||||
this.transform_ = _ol_proj_.getTransformFromProjections(
|
||||
this.mapProjection_, projection);
|
||||
} else {
|
||||
this.transform_ = ol.proj.identityTransform;
|
||||
this.transform_ = _ol_proj_.identityTransform;
|
||||
}
|
||||
}
|
||||
var map = this.getMap();
|
||||
@@ -241,7 +244,8 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
ol.control.MousePosition.Property_ = {
|
||||
_ol_control_MousePosition_.Property_ = {
|
||||
PROJECTION: 'projection',
|
||||
COORDINATE_FORMAT: 'coordinateFormat'
|
||||
};
|
||||
export default _ol_control_MousePosition_;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
goog.provide('ol.control.OverviewMap');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.PluggableMap');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.MapProperty');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.ObjectEventType');
|
||||
goog.require('ol.Overlay');
|
||||
goog.require('ol.OverlayPositioning');
|
||||
goog.require('ol.ViewProperty');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
|
||||
/**
|
||||
* @module ol/control/OverviewMap
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_Collection_ from '../Collection.js';
|
||||
import _ol_PluggableMap_ from '../PluggableMap.js';
|
||||
import _ol_MapEventType_ from '../MapEventType.js';
|
||||
import _ol_MapProperty_ from '../MapProperty.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_ObjectEventType_ from '../ObjectEventType.js';
|
||||
import _ol_Overlay_ from '../Overlay.js';
|
||||
import _ol_OverlayPositioning_ from '../OverlayPositioning.js';
|
||||
import _ol_ViewProperty_ from '../ViewProperty.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_dom_ from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
|
||||
/**
|
||||
* Create a new control with a map acting as an overview map for an other
|
||||
@@ -27,7 +27,7 @@ goog.require('ol.extent');
|
||||
* @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap = function(opt_options) {
|
||||
var _ol_control_OverviewMap_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -86,7 +86,7 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
button.title = tipLabel;
|
||||
button.appendChild(activeLabel);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
/**
|
||||
@@ -100,9 +100,9 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
* @type {ol.PluggableMap}
|
||||
* @private
|
||||
*/
|
||||
this.ovmap_ = new ol.PluggableMap({
|
||||
controls: new ol.Collection(),
|
||||
interactions: new ol.Collection(),
|
||||
this.ovmap_ = new _ol_PluggableMap_({
|
||||
controls: new _ol_Collection_(),
|
||||
interactions: new _ol_Collection_(),
|
||||
view: options.view
|
||||
});
|
||||
var ovmap = this.ovmap_;
|
||||
@@ -125,15 +125,15 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
* @type {ol.Overlay}
|
||||
* @private
|
||||
*/
|
||||
this.boxOverlay_ = new ol.Overlay({
|
||||
this.boxOverlay_ = new _ol_Overlay_({
|
||||
position: [0, 0],
|
||||
positioning: ol.OverlayPositioning.BOTTOM_LEFT,
|
||||
positioning: _ol_OverlayPositioning_.BOTTOM_LEFT,
|
||||
element: box
|
||||
});
|
||||
this.ovmap_.addOverlay(this.boxOverlay_);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL +
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL +
|
||||
(this.collapsed_ && this.collapsible_ ? ' ol-collapsed' : '') +
|
||||
(this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = document.createElement('div');
|
||||
@@ -141,9 +141,9 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
element.appendChild(this.ovmapDiv_);
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.OverviewMap.render;
|
||||
var render = options.render ? options.render : _ol_control_OverviewMap_.render;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -187,14 +187,15 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
window.addEventListener('mouseup', endMoving);
|
||||
});
|
||||
};
|
||||
ol.inherits(ol.control.OverviewMap, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_OverviewMap_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.setMap = function(map) {
|
||||
_ol_control_OverviewMap_.prototype.setMap = function(map) {
|
||||
var oldMap = this.getMap();
|
||||
if (map === oldMap) {
|
||||
return;
|
||||
@@ -206,12 +207,12 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
|
||||
}
|
||||
this.ovmap_.setTarget(null);
|
||||
}
|
||||
ol.control.Control.prototype.setMap.call(this, map);
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
|
||||
if (map) {
|
||||
this.ovmap_.setTarget(this.ovmapDiv_);
|
||||
this.listenerKeys.push(ol.events.listen(
|
||||
map, ol.ObjectEventType.PROPERTYCHANGE,
|
||||
this.listenerKeys.push(_ol_events_.listen(
|
||||
map, _ol_ObjectEventType_.PROPERTYCHANGE,
|
||||
this.handleMapPropertyChange_, this));
|
||||
|
||||
// TODO: to really support map switching, this would need to be reworked
|
||||
@@ -236,8 +237,8 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
|
||||
* @param {ol.Object.Event} event The propertychange event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
||||
if (event.key === ol.MapProperty.VIEW) {
|
||||
_ol_control_OverviewMap_.prototype.handleMapPropertyChange_ = function(event) {
|
||||
if (event.key === _ol_MapProperty_.VIEW) {
|
||||
var oldView = /** @type {ol.View} */ (event.oldValue);
|
||||
if (oldView) {
|
||||
this.unbindView_(oldView);
|
||||
@@ -253,9 +254,9 @@ ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
||||
* @param {ol.View} view The view.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
||||
ol.events.listen(view,
|
||||
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||
_ol_control_OverviewMap_.prototype.bindView_ = function(view) {
|
||||
_ol_events_.listen(view,
|
||||
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
|
||||
this.handleRotationChanged_, this);
|
||||
};
|
||||
|
||||
@@ -265,9 +266,9 @@ ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
||||
* @param {ol.View} view The view.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.unbindView_ = function(view) {
|
||||
ol.events.unlisten(view,
|
||||
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||
_ol_control_OverviewMap_.prototype.unbindView_ = function(view) {
|
||||
_ol_events_.unlisten(view,
|
||||
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
|
||||
this.handleRotationChanged_, this);
|
||||
};
|
||||
|
||||
@@ -278,7 +279,7 @@ ol.control.OverviewMap.prototype.unbindView_ = function(view) {
|
||||
* overview map's view.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.handleRotationChanged_ = function() {
|
||||
_ol_control_OverviewMap_.prototype.handleRotationChanged_ = function() {
|
||||
this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());
|
||||
};
|
||||
|
||||
@@ -289,7 +290,7 @@ ol.control.OverviewMap.prototype.handleRotationChanged_ = function() {
|
||||
* @this {ol.control.OverviewMap}
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.render = function(mapEvent) {
|
||||
_ol_control_OverviewMap_.render = function(mapEvent) {
|
||||
this.validateExtent_();
|
||||
this.updateBox_();
|
||||
};
|
||||
@@ -306,7 +307,7 @@ ol.control.OverviewMap.render = function(mapEvent) {
|
||||
* main map center location.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.validateExtent_ = function() {
|
||||
_ol_control_OverviewMap_.prototype.validateExtent_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -325,9 +326,9 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
|
||||
var ovextent = ovview.calculateExtent(ovmapSize);
|
||||
|
||||
var topLeftPixel =
|
||||
ovmap.getPixelFromCoordinate(ol.extent.getTopLeft(extent));
|
||||
ovmap.getPixelFromCoordinate(_ol_extent_.getTopLeft(extent));
|
||||
var bottomRightPixel =
|
||||
ovmap.getPixelFromCoordinate(ol.extent.getBottomRight(extent));
|
||||
ovmap.getPixelFromCoordinate(_ol_extent_.getBottomRight(extent));
|
||||
|
||||
var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);
|
||||
var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);
|
||||
@@ -335,12 +336,12 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
|
||||
var ovmapWidth = ovmapSize[0];
|
||||
var ovmapHeight = ovmapSize[1];
|
||||
|
||||
if (boxWidth < ovmapWidth * ol.OVERVIEWMAP_MIN_RATIO ||
|
||||
boxHeight < ovmapHeight * ol.OVERVIEWMAP_MIN_RATIO ||
|
||||
boxWidth > ovmapWidth * ol.OVERVIEWMAP_MAX_RATIO ||
|
||||
boxHeight > ovmapHeight * ol.OVERVIEWMAP_MAX_RATIO) {
|
||||
if (boxWidth < ovmapWidth * _ol_.OVERVIEWMAP_MIN_RATIO ||
|
||||
boxHeight < ovmapHeight * _ol_.OVERVIEWMAP_MIN_RATIO ||
|
||||
boxWidth > ovmapWidth * _ol_.OVERVIEWMAP_MAX_RATIO ||
|
||||
boxHeight > ovmapHeight * _ol_.OVERVIEWMAP_MAX_RATIO) {
|
||||
this.resetExtent_();
|
||||
} else if (!ol.extent.containsExtent(ovextent, extent)) {
|
||||
} else if (!_ol_extent_.containsExtent(ovextent, extent)) {
|
||||
this.recenter_();
|
||||
}
|
||||
};
|
||||
@@ -351,8 +352,8 @@ ol.control.OverviewMap.prototype.validateExtent_ = function() {
|
||||
* the extent of the main map.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.resetExtent_ = function() {
|
||||
if (ol.OVERVIEWMAP_MAX_RATIO === 0 || ol.OVERVIEWMAP_MIN_RATIO === 0) {
|
||||
_ol_control_OverviewMap_.prototype.resetExtent_ = function() {
|
||||
if (_ol_.OVERVIEWMAP_MAX_RATIO === 0 || _ol_.OVERVIEWMAP_MIN_RATIO === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -370,9 +371,9 @@ ol.control.OverviewMap.prototype.resetExtent_ = function() {
|
||||
// box sizes using the min and max ratio, pick the step in the middle used
|
||||
// to calculate the extent from the main map to set it to the overview map,
|
||||
var steps = Math.log(
|
||||
ol.OVERVIEWMAP_MAX_RATIO / ol.OVERVIEWMAP_MIN_RATIO) / Math.LN2;
|
||||
var ratio = 1 / (Math.pow(2, steps / 2) * ol.OVERVIEWMAP_MIN_RATIO);
|
||||
ol.extent.scaleFromCenter(extent, ratio);
|
||||
_ol_.OVERVIEWMAP_MAX_RATIO / _ol_.OVERVIEWMAP_MIN_RATIO) / Math.LN2;
|
||||
var ratio = 1 / (Math.pow(2, steps / 2) * _ol_.OVERVIEWMAP_MIN_RATIO);
|
||||
_ol_extent_.scaleFromCenter(extent, ratio);
|
||||
ovview.fit(extent);
|
||||
};
|
||||
|
||||
@@ -382,7 +383,7 @@ ol.control.OverviewMap.prototype.resetExtent_ = function() {
|
||||
* resolution.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.recenter_ = function() {
|
||||
_ol_control_OverviewMap_.prototype.recenter_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -398,7 +399,7 @@ ol.control.OverviewMap.prototype.recenter_ = function() {
|
||||
* Update the box using the main map extent
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.updateBox_ = function() {
|
||||
_ol_control_OverviewMap_.prototype.updateBox_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -418,8 +419,8 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
|
||||
var box = this.boxOverlay_.getElement();
|
||||
var extent = view.calculateExtent(mapSize);
|
||||
var ovresolution = ovview.getResolution();
|
||||
var bottomLeft = ol.extent.getBottomLeft(extent);
|
||||
var topRight = ol.extent.getTopRight(extent);
|
||||
var bottomLeft = _ol_extent_.getBottomLeft(extent);
|
||||
var topRight = _ol_extent_.getTopRight(extent);
|
||||
|
||||
// set position using bottom left coordinates
|
||||
var rotateBottomLeft = this.calculateCoordinateRotate_(rotation, bottomLeft);
|
||||
@@ -439,7 +440,7 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
|
||||
* @return {ol.Coordinate|undefined} Coordinate for rotation and center anchor.
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
_ol_control_OverviewMap_.prototype.calculateCoordinateRotate_ = function(
|
||||
rotation, coordinate) {
|
||||
var coordinateRotate;
|
||||
|
||||
@@ -453,8 +454,8 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
coordinate[0] - currentCenter[0],
|
||||
coordinate[1] - currentCenter[1]
|
||||
];
|
||||
ol.coordinate.rotate(coordinateRotate, rotation);
|
||||
ol.coordinate.add(coordinateRotate, currentCenter);
|
||||
_ol_coordinate_.rotate(coordinateRotate, rotation);
|
||||
_ol_coordinate_.add(coordinateRotate, currentCenter);
|
||||
}
|
||||
return coordinateRotate;
|
||||
};
|
||||
@@ -464,7 +465,7 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.handleClick_ = function(event) {
|
||||
_ol_control_OverviewMap_.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
};
|
||||
@@ -473,12 +474,12 @@ ol.control.OverviewMap.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.handleToggle_ = function() {
|
||||
_ol_control_OverviewMap_.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
ol.dom.replaceNode(this.collapseLabel_, this.label_);
|
||||
_ol_dom_.replaceNode(this.collapseLabel_, this.label_);
|
||||
} else {
|
||||
ol.dom.replaceNode(this.label_, this.collapseLabel_);
|
||||
_ol_dom_.replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
|
||||
@@ -488,7 +489,7 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
|
||||
if (!this.collapsed_ && !ovmap.isRendered()) {
|
||||
ovmap.updateSize();
|
||||
this.resetExtent_();
|
||||
ol.events.listenOnce(ovmap, ol.MapEventType.POSTRENDER,
|
||||
_ol_events_.listenOnce(ovmap, _ol_MapEventType_.POSTRENDER,
|
||||
function(event) {
|
||||
this.updateBox_();
|
||||
},
|
||||
@@ -502,7 +503,7 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.getCollapsible = function() {
|
||||
_ol_control_OverviewMap_.prototype.getCollapsible = function() {
|
||||
return this.collapsible_;
|
||||
};
|
||||
|
||||
@@ -512,7 +513,7 @@ ol.control.OverviewMap.prototype.getCollapsible = function() {
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
|
||||
_ol_control_OverviewMap_.prototype.setCollapsible = function(collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
@@ -531,7 +532,7 @@ ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
|
||||
_ol_control_OverviewMap_.prototype.setCollapsed = function(collapsed) {
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
@@ -544,7 +545,7 @@ ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
|
||||
* @return {boolean} The overview map is collapsed.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.getCollapsed = function() {
|
||||
_ol_control_OverviewMap_.prototype.getCollapsed = function() {
|
||||
return this.collapsed_;
|
||||
};
|
||||
|
||||
@@ -554,6 +555,7 @@ ol.control.OverviewMap.prototype.getCollapsed = function() {
|
||||
* @return {ol.PluggableMap} Overview map.
|
||||
* @api
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.getOverviewMap = function() {
|
||||
_ol_control_OverviewMap_.prototype.getOverviewMap = function() {
|
||||
return this.ovmap_;
|
||||
};
|
||||
export default _ol_control_OverviewMap_;
|
||||
|
||||
+27
-25
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.control.Rotate');
|
||||
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.easing');
|
||||
|
||||
/**
|
||||
* @module ol/control/Rotate
|
||||
*/
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_easing_ from '../easing.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -19,7 +19,7 @@ goog.require('ol.easing');
|
||||
* @param {olx.control.RotateOptions=} opt_options Rotate options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Rotate = function(opt_options) {
|
||||
var _ol_control_Rotate_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -50,20 +50,20 @@ ol.control.Rotate = function(opt_options) {
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.label_);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
ol.control.Rotate.prototype.handleClick_, this);
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Rotate_.prototype.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL;
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : ol.control.Rotate.render;
|
||||
var render = options.render ? options.render : _ol_control_Rotate_.render;
|
||||
|
||||
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -88,18 +88,19 @@ ol.control.Rotate = function(opt_options) {
|
||||
this.rotation_ = undefined;
|
||||
|
||||
if (this.autoHide_) {
|
||||
this.element.classList.add(ol.css.CLASS_HIDDEN);
|
||||
this.element.classList.add(_ol_css_.CLASS_HIDDEN);
|
||||
}
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.Rotate, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_Rotate_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Rotate.prototype.handleClick_ = function(event) {
|
||||
_ol_control_Rotate_.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
if (this.callResetNorth_ !== undefined) {
|
||||
this.callResetNorth_();
|
||||
@@ -112,7 +113,7 @@ ol.control.Rotate.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
_ol_control_Rotate_.prototype.resetNorth_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
@@ -125,7 +126,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
view.animate({
|
||||
rotation: 0,
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
easing: _ol_easing_.easeOut
|
||||
});
|
||||
} else {
|
||||
view.setRotation(0);
|
||||
@@ -140,7 +141,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
* @this {ol.control.Rotate}
|
||||
* @api
|
||||
*/
|
||||
ol.control.Rotate.render = function(mapEvent) {
|
||||
_ol_control_Rotate_.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
return;
|
||||
@@ -149,11 +150,11 @@ ol.control.Rotate.render = function(mapEvent) {
|
||||
if (rotation != this.rotation_) {
|
||||
var transform = 'rotate(' + rotation + 'rad)';
|
||||
if (this.autoHide_) {
|
||||
var contains = this.element.classList.contains(ol.css.CLASS_HIDDEN);
|
||||
var contains = this.element.classList.contains(_ol_css_.CLASS_HIDDEN);
|
||||
if (!contains && rotation === 0) {
|
||||
this.element.classList.add(ol.css.CLASS_HIDDEN);
|
||||
this.element.classList.add(_ol_css_.CLASS_HIDDEN);
|
||||
} else if (contains && rotation !== 0) {
|
||||
this.element.classList.remove(ol.css.CLASS_HIDDEN);
|
||||
this.element.classList.remove(_ol_css_.CLASS_HIDDEN);
|
||||
}
|
||||
}
|
||||
this.label_.style.msTransform = transform;
|
||||
@@ -162,3 +163,4 @@ ol.control.Rotate.render = function(mapEvent) {
|
||||
}
|
||||
this.rotation_ = rotation;
|
||||
};
|
||||
export default _ol_control_Rotate_;
|
||||
|
||||
+47
-44
@@ -1,15 +1,15 @@
|
||||
goog.provide('ol.control.ScaleLine');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.asserts');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.control.ScaleLineUnits');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.proj.Units');
|
||||
|
||||
/**
|
||||
* @module ol/control/ScaleLine
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_control_ScaleLineUnits_ from '../control/ScaleLineUnits.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -26,7 +26,7 @@ goog.require('ol.proj.Units');
|
||||
* @param {olx.control.ScaleLineOptions=} opt_options Scale line options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.ScaleLine = function(opt_options) {
|
||||
var _ol_control_ScaleLine_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -44,7 +44,7 @@ ol.control.ScaleLine = function(opt_options) {
|
||||
* @type {Element}
|
||||
*/
|
||||
this.element_ = document.createElement('DIV');
|
||||
this.element_.className = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||
this.element_.className = className + ' ' + _ol_css_.CLASS_UNSELECTABLE;
|
||||
this.element_.appendChild(this.innerElement_);
|
||||
|
||||
/**
|
||||
@@ -77,30 +77,31 @@ ol.control.ScaleLine = function(opt_options) {
|
||||
*/
|
||||
this.renderedHTML_ = '';
|
||||
|
||||
var render = options.render ? options.render : ol.control.ScaleLine.render;
|
||||
var render = options.render ? options.render : _ol_control_ScaleLine_.render;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: this.element_,
|
||||
render: render,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.control.ScaleLine.Property_.UNITS),
|
||||
_ol_events_.listen(
|
||||
this, _ol_Object_.getChangeEventType(_ol_control_ScaleLine_.Property_.UNITS),
|
||||
this.handleUnitsChanged_, this);
|
||||
|
||||
this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) ||
|
||||
ol.control.ScaleLineUnits.METRIC);
|
||||
_ol_control_ScaleLineUnits_.METRIC);
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.ScaleLine, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_ScaleLine_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
||||
_ol_control_ScaleLine_.LEADING_DIGITS = [1, 2, 5];
|
||||
|
||||
|
||||
/**
|
||||
@@ -110,9 +111,10 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.ScaleLine.prototype.getUnits = function() {
|
||||
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
|
||||
this.get(ol.control.ScaleLine.Property_.UNITS));
|
||||
_ol_control_ScaleLine_.prototype.getUnits = function() {
|
||||
return (
|
||||
/** @type {ol.control.ScaleLineUnits|undefined} */ this.get(_ol_control_ScaleLine_.Property_.UNITS)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -122,7 +124,7 @@ ol.control.ScaleLine.prototype.getUnits = function() {
|
||||
* @this {ol.control.ScaleLine}
|
||||
* @api
|
||||
*/
|
||||
ol.control.ScaleLine.render = function(mapEvent) {
|
||||
_ol_control_ScaleLine_.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.viewState_ = null;
|
||||
@@ -136,7 +138,7 @@ ol.control.ScaleLine.render = function(mapEvent) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
|
||||
_ol_control_ScaleLine_.prototype.handleUnitsChanged_ = function() {
|
||||
this.updateElement_();
|
||||
};
|
||||
|
||||
@@ -147,15 +149,15 @@ ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ol.control.ScaleLine.prototype.setUnits = function(units) {
|
||||
this.set(ol.control.ScaleLine.Property_.UNITS, units);
|
||||
_ol_control_ScaleLine_.prototype.setUnits = function(units) {
|
||||
this.set(_ol_control_ScaleLine_.Property_.UNITS, units);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
_ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
var viewState = this.viewState_;
|
||||
|
||||
if (!viewState) {
|
||||
@@ -169,20 +171,20 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
var center = viewState.center;
|
||||
var projection = viewState.projection;
|
||||
var units = this.getUnits();
|
||||
var pointResolutionUnits = units == ol.control.ScaleLineUnits.DEGREES ?
|
||||
ol.proj.Units.DEGREES :
|
||||
ol.proj.Units.METERS;
|
||||
var pointResolutionUnits = units == _ol_control_ScaleLineUnits_.DEGREES ?
|
||||
_ol_proj_Units_.DEGREES :
|
||||
_ol_proj_Units_.METERS;
|
||||
var pointResolution =
|
||||
ol.proj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
||||
if (units != ol.control.ScaleLineUnits.DEGREES) {
|
||||
_ol_proj_.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
||||
if (units != _ol_control_ScaleLineUnits_.DEGREES) {
|
||||
pointResolution *= projection.getMetersPerUnit();
|
||||
}
|
||||
|
||||
var nominalCount = this.minWidth_ * pointResolution;
|
||||
var suffix = '';
|
||||
if (units == ol.control.ScaleLineUnits.DEGREES) {
|
||||
var metersPerDegree = ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES];
|
||||
if (projection.getUnits() == ol.proj.Units.DEGREES) {
|
||||
if (units == _ol_control_ScaleLineUnits_.DEGREES) {
|
||||
var metersPerDegree = _ol_proj_.METERS_PER_UNIT[_ol_proj_Units_.DEGREES];
|
||||
if (projection.getUnits() == _ol_proj_Units_.DEGREES) {
|
||||
nominalCount *= metersPerDegree;
|
||||
} else {
|
||||
pointResolution /= metersPerDegree;
|
||||
@@ -196,7 +198,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
} else {
|
||||
suffix = '\u00b0'; // degrees
|
||||
}
|
||||
} else if (units == ol.control.ScaleLineUnits.IMPERIAL) {
|
||||
} else if (units == _ol_control_ScaleLineUnits_.IMPERIAL) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution /= 0.0254;
|
||||
@@ -207,10 +209,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
suffix = 'mi';
|
||||
pointResolution /= 1609.344;
|
||||
}
|
||||
} else if (units == ol.control.ScaleLineUnits.NAUTICAL) {
|
||||
} else if (units == _ol_control_ScaleLineUnits_.NAUTICAL) {
|
||||
pointResolution /= 1852;
|
||||
suffix = 'nm';
|
||||
} else if (units == ol.control.ScaleLineUnits.METRIC) {
|
||||
} else if (units == _ol_control_ScaleLineUnits_.METRIC) {
|
||||
if (nominalCount < 0.001) {
|
||||
suffix = 'μm';
|
||||
pointResolution *= 1000000;
|
||||
@@ -223,7 +225,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
suffix = 'km';
|
||||
pointResolution /= 1000;
|
||||
}
|
||||
} else if (units == ol.control.ScaleLineUnits.US) {
|
||||
} else if (units == _ol_control_ScaleLineUnits_.US) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution *= 39.37;
|
||||
@@ -235,14 +237,14 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
pointResolution /= 1609.3472;
|
||||
}
|
||||
} else {
|
||||
ol.asserts.assert(false, 33); // Invalid units
|
||||
_ol_asserts_.assert(false, 33); // Invalid units
|
||||
}
|
||||
|
||||
var i = 3 * Math.floor(
|
||||
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
|
||||
var count, width;
|
||||
while (true) {
|
||||
count = ol.control.ScaleLine.LEADING_DIGITS[((i % 3) + 3) % 3] *
|
||||
count = _ol_control_ScaleLine_.LEADING_DIGITS[((i % 3) + 3) % 3] *
|
||||
Math.pow(10, Math.floor(i / 3));
|
||||
width = Math.round(count / pointResolution);
|
||||
if (isNaN(width)) {
|
||||
@@ -278,6 +280,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
ol.control.ScaleLine.Property_ = {
|
||||
_ol_control_ScaleLine_.Property_ = {
|
||||
UNITS: 'units'
|
||||
};
|
||||
export default _ol_control_ScaleLine_;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
goog.provide('ol.control.ScaleLineUnits');
|
||||
|
||||
/**
|
||||
* @module ol/control/ScaleLineUnits
|
||||
*/
|
||||
/**
|
||||
* Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
|
||||
* `'nautical'`, `'metric'`, `'us'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.control.ScaleLineUnits = {
|
||||
var _ol_control_ScaleLineUnits_ = {
|
||||
DEGREES: 'degrees',
|
||||
IMPERIAL: 'imperial',
|
||||
NAUTICAL: 'nautical',
|
||||
METRIC: 'metric',
|
||||
US: 'us'
|
||||
};
|
||||
|
||||
export default _ol_control_ScaleLineUnits_;
|
||||
|
||||
+23
-21
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.control.Zoom');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.easing');
|
||||
|
||||
/**
|
||||
* @module ol/control/Zoom
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_easing_ from '../easing.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -19,7 +19,7 @@ goog.require('ol.easing');
|
||||
* @param {olx.control.ZoomOptions=} opt_options Zoom options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.Zoom = function(opt_options) {
|
||||
var _ol_control_Zoom_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -43,8 +43,8 @@ ol.control.Zoom = function(opt_options) {
|
||||
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
|
||||
);
|
||||
|
||||
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
|
||||
_ol_events_.listen(inElement, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Zoom_.prototype.handleClick_.bind(this, delta));
|
||||
|
||||
var outElement = document.createElement('button');
|
||||
outElement.className = className + '-out';
|
||||
@@ -54,17 +54,17 @@ ol.control.Zoom = function(opt_options) {
|
||||
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
|
||||
);
|
||||
|
||||
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
||||
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
|
||||
_ol_events_.listen(outElement, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Zoom_.prototype.handleClick_.bind(this, -delta));
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL;
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(inElement);
|
||||
element.appendChild(outElement);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
@@ -76,7 +76,8 @@ ol.control.Zoom = function(opt_options) {
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
|
||||
};
|
||||
ol.inherits(ol.control.Zoom, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_Zoom_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,7 @@ ol.inherits(ol.control.Zoom, ol.control.Control);
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
_ol_control_Zoom_.prototype.handleClick_ = function(delta, event) {
|
||||
event.preventDefault();
|
||||
this.zoomByDelta_(delta);
|
||||
};
|
||||
@@ -94,7 +95,7 @@ ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
* @param {number} delta Zoom delta.
|
||||
* @private
|
||||
*/
|
||||
ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
|
||||
_ol_control_Zoom_.prototype.zoomByDelta_ = function(delta) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
@@ -112,10 +113,11 @@ ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
|
||||
view.animate({
|
||||
resolution: newResolution,
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
easing: _ol_easing_.easeOut
|
||||
});
|
||||
} else {
|
||||
view.setResolution(newResolution);
|
||||
}
|
||||
}
|
||||
};
|
||||
export default _ol_control_Zoom_;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/**
|
||||
* @module ol/control/ZoomSlider
|
||||
*/
|
||||
// FIXME should possibly show tooltip when dragging?
|
||||
|
||||
goog.provide('ol.control.ZoomSlider');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.easing');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.pointer.EventType');
|
||||
goog.require('ol.pointer.PointerEventHandler');
|
||||
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_ViewHint_ from '../ViewHint.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_easing_ from '../easing.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_Event_ from '../events/Event.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
import _ol_pointer_EventType_ from '../pointer/EventType.js';
|
||||
import _ol_pointer_PointerEventHandler_ from '../pointer/PointerEventHandler.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -28,7 +28,7 @@ goog.require('ol.pointer.PointerEventHandler');
|
||||
* @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.ZoomSlider = function(opt_options) {
|
||||
var _ol_control_ZoomSlider_ = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -47,7 +47,7 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
* @type {ol.control.ZoomSlider.Direction_}
|
||||
* @private
|
||||
*/
|
||||
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
|
||||
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
@@ -103,44 +103,45 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoomslider';
|
||||
var thumbElement = document.createElement('button');
|
||||
thumbElement.setAttribute('type', 'button');
|
||||
thumbElement.className = className + '-thumb ' + ol.css.CLASS_UNSELECTABLE;
|
||||
thumbElement.className = className + '-thumb ' + _ol_css_.CLASS_UNSELECTABLE;
|
||||
var containerElement = document.createElement('div');
|
||||
containerElement.className = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' + ol.css.CLASS_CONTROL;
|
||||
containerElement.className = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' + _ol_css_.CLASS_CONTROL;
|
||||
containerElement.appendChild(thumbElement);
|
||||
/**
|
||||
* @type {ol.pointer.PointerEventHandler}
|
||||
* @private
|
||||
*/
|
||||
this.dragger_ = new ol.pointer.PointerEventHandler(containerElement);
|
||||
this.dragger_ = new _ol_pointer_PointerEventHandler_(containerElement);
|
||||
|
||||
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERDOWN,
|
||||
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERDOWN,
|
||||
this.handleDraggerStart_, this);
|
||||
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERMOVE,
|
||||
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERMOVE,
|
||||
this.handleDraggerDrag_, this);
|
||||
ol.events.listen(this.dragger_, ol.pointer.EventType.POINTERUP,
|
||||
_ol_events_.listen(this.dragger_, _ol_pointer_EventType_.POINTERUP,
|
||||
this.handleDraggerEnd_, this);
|
||||
|
||||
ol.events.listen(containerElement, ol.events.EventType.CLICK,
|
||||
_ol_events_.listen(containerElement, _ol_events_EventType_.CLICK,
|
||||
this.handleContainerClick_, this);
|
||||
ol.events.listen(thumbElement, ol.events.EventType.CLICK,
|
||||
ol.events.Event.stopPropagation);
|
||||
_ol_events_.listen(thumbElement, _ol_events_EventType_.CLICK,
|
||||
_ol_events_Event_.stopPropagation);
|
||||
|
||||
var render = options.render ? options.render : ol.control.ZoomSlider.render;
|
||||
var render = options.render ? options.render : _ol_control_ZoomSlider_.render;
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: containerElement,
|
||||
render: render
|
||||
});
|
||||
};
|
||||
ol.inherits(ol.control.ZoomSlider, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_ZoomSlider_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.disposeInternal = function() {
|
||||
_ol_control_ZoomSlider_.prototype.disposeInternal = function() {
|
||||
this.dragger_.dispose();
|
||||
ol.control.Control.prototype.disposeInternal.call(this);
|
||||
_ol_control_Control_.prototype.disposeInternal.call(this);
|
||||
};
|
||||
|
||||
|
||||
@@ -150,7 +151,7 @@ ol.control.ZoomSlider.prototype.disposeInternal = function() {
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.Direction_ = {
|
||||
_ol_control_ZoomSlider_.Direction_ = {
|
||||
VERTICAL: 0,
|
||||
HORIZONTAL: 1
|
||||
};
|
||||
@@ -159,8 +160,8 @@ ol.control.ZoomSlider.Direction_ = {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setMap = function(map) {
|
||||
ol.control.Control.prototype.setMap.call(this, map);
|
||||
_ol_control_ZoomSlider_.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
map.render();
|
||||
}
|
||||
@@ -174,7 +175,7 @@ ol.control.ZoomSlider.prototype.setMap = function(map) {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
_ol_control_ZoomSlider_.prototype.initSlider_ = function() {
|
||||
var container = this.element;
|
||||
var containerSize = {
|
||||
width: container.offsetWidth, height: container.offsetHeight
|
||||
@@ -191,10 +192,10 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
this.thumbSize_ = [thumbWidth, thumbHeight];
|
||||
|
||||
if (containerSize.width > containerSize.height) {
|
||||
this.direction_ = ol.control.ZoomSlider.Direction_.HORIZONTAL;
|
||||
this.direction_ = _ol_control_ZoomSlider_.Direction_.HORIZONTAL;
|
||||
this.widthLimit_ = containerSize.width - thumbWidth;
|
||||
} else {
|
||||
this.direction_ = ol.control.ZoomSlider.Direction_.VERTICAL;
|
||||
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
|
||||
this.heightLimit_ = containerSize.height - thumbHeight;
|
||||
}
|
||||
this.sliderInitialized_ = true;
|
||||
@@ -207,7 +208,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
* @this {ol.control.ZoomSlider}
|
||||
* @api
|
||||
*/
|
||||
ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
_ol_control_ZoomSlider_.render = function(mapEvent) {
|
||||
if (!mapEvent.frameState) {
|
||||
return;
|
||||
}
|
||||
@@ -226,7 +227,7 @@ ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
* @param {Event} event The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
_ol_control_ZoomSlider_.prototype.handleContainerClick_ = function(event) {
|
||||
var view = this.getMap().getView();
|
||||
|
||||
var relativePosition = this.getRelativePosition_(
|
||||
@@ -238,7 +239,7 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
view.animate({
|
||||
resolution: view.constrainResolution(resolution),
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
easing: _ol_easing_.easeOut
|
||||
});
|
||||
};
|
||||
|
||||
@@ -248,9 +249,9 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
* @param {ol.pointer.PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
||||
_ol_control_ZoomSlider_.prototype.handleDraggerStart_ = function(event) {
|
||||
if (!this.dragging_ && event.originalEvent.target === this.element.firstElementChild) {
|
||||
this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||
this.getMap().getView().setHint(_ol_ViewHint_.INTERACTING, 1);
|
||||
this.previousX_ = event.clientX;
|
||||
this.previousY_ = event.clientY;
|
||||
this.dragging_ = true;
|
||||
@@ -264,7 +265,7 @@ ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
||||
* @param {ol.pointer.PointerEvent|Event} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
|
||||
_ol_control_ZoomSlider_.prototype.handleDraggerDrag_ = function(event) {
|
||||
if (this.dragging_) {
|
||||
var element = this.element.firstElementChild;
|
||||
var deltaX = event.clientX - this.previousX_ + parseInt(element.style.left, 10);
|
||||
@@ -284,15 +285,15 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
|
||||
* @param {ol.pointer.PointerEvent|Event} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||
_ol_control_ZoomSlider_.prototype.handleDraggerEnd_ = function(event) {
|
||||
if (this.dragging_) {
|
||||
var view = this.getMap().getView();
|
||||
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||
view.setHint(_ol_ViewHint_.INTERACTING, -1);
|
||||
|
||||
view.animate({
|
||||
resolution: view.constrainResolution(this.currentResolution_),
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
easing: _ol_easing_.easeOut
|
||||
});
|
||||
|
||||
this.dragging_ = false;
|
||||
@@ -308,11 +309,11 @@ ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||
* @param {number} res The res.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
||||
_ol_control_ZoomSlider_.prototype.setThumbPosition_ = function(res) {
|
||||
var position = this.getPositionForResolution_(res);
|
||||
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';
|
||||
} else {
|
||||
thumb.style.top = this.heightLimit_ * position + 'px';
|
||||
@@ -330,14 +331,14 @@ ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
||||
* @return {number} The relative position of the thumb.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
||||
_ol_control_ZoomSlider_.prototype.getRelativePosition_ = function(x, y) {
|
||||
var amount;
|
||||
if (this.direction_ === ol.control.ZoomSlider.Direction_.HORIZONTAL) {
|
||||
if (this.direction_ === _ol_control_ZoomSlider_.Direction_.HORIZONTAL) {
|
||||
amount = x / this.widthLimit_;
|
||||
} else {
|
||||
amount = y / this.heightLimit_;
|
||||
}
|
||||
return ol.math.clamp(amount, 0, 1);
|
||||
return _ol_math_.clamp(amount, 0, 1);
|
||||
};
|
||||
|
||||
|
||||
@@ -349,7 +350,7 @@ ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
||||
* @return {number} The corresponding resolution.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.getResolutionForPosition_ = function(position) {
|
||||
_ol_control_ZoomSlider_.prototype.getResolutionForPosition_ = function(position) {
|
||||
var fn = this.getMap().getView().getResolutionForValueFunction();
|
||||
return fn(1 - position);
|
||||
};
|
||||
@@ -364,7 +365,8 @@ ol.control.ZoomSlider.prototype.getResolutionForPosition_ = function(position) {
|
||||
* @return {number} The relative position value (between 0 and 1).
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.getPositionForResolution_ = function(res) {
|
||||
_ol_control_ZoomSlider_.prototype.getPositionForResolution_ = function(res) {
|
||||
var fn = this.getMap().getView().getValueForResolutionFunction();
|
||||
return 1 - fn(res);
|
||||
};
|
||||
export default _ol_control_ZoomSlider_;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.control.ZoomToExtent');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
|
||||
/**
|
||||
* @module ol/control/ZoomToExtent
|
||||
*/
|
||||
import _ol_ from '../index.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -17,7 +17,7 @@ goog.require('ol.css');
|
||||
* @param {olx.control.ZoomToExtentOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
ol.control.ZoomToExtent = function(opt_options) {
|
||||
var _ol_control_ZoomToExtent_ = function(opt_options) {
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
@@ -39,28 +39,29 @@ ol.control.ZoomToExtent = function(opt_options) {
|
||||
typeof label === 'string' ? document.createTextNode(label) : label
|
||||
);
|
||||
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL;
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
ol.control.Control.call(this, {
|
||||
_ol_control_Control_.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
};
|
||||
ol.inherits(ol.control.ZoomToExtent, ol.control.Control);
|
||||
|
||||
_ol_.inherits(_ol_control_ZoomToExtent_, _ol_control_Control_);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
_ol_control_ZoomToExtent_.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleZoomToExtent();
|
||||
};
|
||||
@@ -69,9 +70,10 @@ ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.control.ZoomToExtent.prototype.handleZoomToExtent = function() {
|
||||
_ol_control_ZoomToExtent_.prototype.handleZoomToExtent = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
|
||||
view.fit(extent);
|
||||
};
|
||||
export default _ol_control_ZoomToExtent_;
|
||||
|
||||
Reference in New Issue
Block a user