Merge pull request #7594 from tschaub/rename-controls
Rename control variables
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_Attribution_ from '../src/ol/control/Attribution.js';
|
||||
import Attribution from '../src/ol/control/Attribution.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
var attribution = new _ol_control_Attribution_({
|
||||
var attribution = new Attribution({
|
||||
collapsible: false
|
||||
});
|
||||
var map = new _ol_Map_({
|
||||
|
||||
@@ -2,7 +2,7 @@ import {inherits} from '../src/ol/index.js';
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_Control_ from '../src/ol/control/Control.js';
|
||||
import Control from '../src/ol/control/Control.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
@@ -43,13 +43,13 @@ app.RotateNorthControl = function(opt_options) {
|
||||
element.className = 'rotate-north ol-unselectable ol-control';
|
||||
element.appendChild(button);
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
};
|
||||
inherits(app.RotateNorthControl, _ol_control_Control_);
|
||||
inherits(app.RotateNorthControl, Control);
|
||||
|
||||
|
||||
//
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_ScaleLine_ from '../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../src/ol/control/ScaleLine.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
|
||||
|
||||
@@ -20,7 +20,7 @@ var layers = [
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_ScaleLine_({
|
||||
new ScaleLine({
|
||||
units: 'degrees'
|
||||
})
|
||||
]),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js';
|
||||
import FullScreen from '../src/ol/control/FullScreen.js';
|
||||
import _ol_interaction_ from '../src/ol/interaction.js';
|
||||
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
@@ -10,7 +10,7 @@ import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_FullScreen_()
|
||||
new FullScreen()
|
||||
]),
|
||||
interactions: _ol_interaction_.defaults().extend([
|
||||
new _ol_interaction_DragRotateAndZoom_()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js';
|
||||
import FullScreen from '../src/ol/control/FullScreen.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
@@ -13,7 +13,7 @@ var view = new _ol_View_({
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_FullScreen_({
|
||||
new FullScreen({
|
||||
source: 'fullscreen'
|
||||
})
|
||||
]),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_FullScreen_ from '../src/ol/control/FullScreen.js';
|
||||
import FullScreen from '../src/ol/control/FullScreen.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
|
||||
|
||||
@@ -13,7 +13,7 @@ var view = new _ol_View_({
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_FullScreen_()
|
||||
new FullScreen()
|
||||
]),
|
||||
layers: [
|
||||
new _ol_layer_Tile_({
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_MousePosition_ from '../src/ol/control/MousePosition.js';
|
||||
import MousePosition from '../src/ol/control/MousePosition.js';
|
||||
import _ol_coordinate_ from '../src/ol/coordinate.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
var mousePositionControl = new _ol_control_MousePosition_({
|
||||
var mousePositionControl = new MousePosition({
|
||||
coordinateFormat: _ol_coordinate_.createStringXY(4),
|
||||
projection: 'EPSG:4326',
|
||||
// comment the following two lines to have the mouse position
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_ZoomToExtent_ from '../src/ol/control/ZoomToExtent.js';
|
||||
import ZoomToExtent from '../src/ol/control/ZoomToExtent.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
@@ -12,7 +12,7 @@ var map = new _ol_Map_({
|
||||
collapsible: false
|
||||
}
|
||||
}).extend([
|
||||
new _ol_control_ZoomToExtent_({
|
||||
new ZoomToExtent({
|
||||
extent: [
|
||||
813079.7791264898, 5929220.284081122,
|
||||
848966.9639063801, 5936863.986909639
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_OverviewMap_ from '../src/ol/control/OverviewMap.js';
|
||||
import OverviewMap from '../src/ol/control/OverviewMap.js';
|
||||
import _ol_interaction_ from '../src/ol/interaction.js';
|
||||
import _ol_interaction_DragRotateAndZoom_ from '../src/ol/interaction/DragRotateAndZoom.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
|
||||
var overviewMapControl = new _ol_control_OverviewMap_({
|
||||
var overviewMapControl = new OverviewMap({
|
||||
// see in overviewmap-custom.html to see the custom CSS used
|
||||
className: 'ol-overviewmap ol-custom-overviewmap',
|
||||
layers: [
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_OverviewMap_ from '../src/ol/control/OverviewMap.js';
|
||||
import OverviewMap from '../src/ol/control/OverviewMap.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_OverviewMap_()
|
||||
new OverviewMap()
|
||||
]),
|
||||
layers: [
|
||||
new _ol_layer_Tile_({
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_ScaleLine_ from '../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../src/ol/control/ScaleLine.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
|
||||
var scaleLineControl = new _ol_control_ScaleLine_();
|
||||
var scaleLineControl = new ScaleLine();
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ScaleLine_ from '../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../src/ol/control/ScaleLine.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import {fromLonLat, transformExtent} from '../src/ol/proj.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
@@ -32,4 +32,4 @@ var map = new _ol_Map_({
|
||||
})
|
||||
});
|
||||
|
||||
map.addControl(new _ol_control_ScaleLine_({units: 'us'}));
|
||||
map.addControl(new ScaleLine({units: 'us'}));
|
||||
|
||||
@@ -18,7 +18,7 @@ import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
|
||||
import _ol_style_Fill_ from '../src/ol/style/Fill.js';
|
||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||
import _ol_style_Text_ from '../src/ol/style/Text.js';
|
||||
import _ol_control_MousePosition_ from '../src/ol/control/MousePosition.js';
|
||||
import MousePosition from '../src/ol/control/MousePosition.js';
|
||||
|
||||
var raster = new _ol_layer_Tile_({
|
||||
source: new _ol_source_OSM_()
|
||||
@@ -213,4 +213,4 @@ var snap = new _ol_interaction_Snap_({
|
||||
source: edges
|
||||
});
|
||||
map.addInteraction(snap);
|
||||
map.addControl(new _ol_control_MousePosition_());
|
||||
map.addControl(new MousePosition());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_ScaleLine_ from '../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../src/ol/control/ScaleLine.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import {addProjection, addCoordinateTransforms, transform} from '../src/ol/proj.js';
|
||||
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
||||
@@ -71,7 +71,7 @@ var layers = [
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_ScaleLine_({
|
||||
new ScaleLine({
|
||||
units: 'metric'
|
||||
})
|
||||
]),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ from '../src/ol/control.js';
|
||||
import _ol_control_ScaleLine_ from '../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../src/ol/control/ScaleLine.js';
|
||||
import _ol_layer_Image_ from '../src/ol/layer/Image.js';
|
||||
import {fromLonLat} from '../src/ol/proj.js';
|
||||
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
||||
@@ -59,7 +59,7 @@ var layers = [
|
||||
|
||||
var map = new _ol_Map_({
|
||||
controls: _ol_control_.defaults().extend([
|
||||
new _ol_control_ScaleLine_()
|
||||
new ScaleLine()
|
||||
]),
|
||||
layers: layers,
|
||||
target: 'map',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_Map_ from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import _ol_control_ZoomSlider_ from '../src/ol/control/ZoomSlider.js';
|
||||
import ZoomSlider from '../src/ol/control/ZoomSlider.js';
|
||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
|
||||
@@ -26,7 +26,7 @@ var createMap = function(divId) {
|
||||
zoom: 2
|
||||
})
|
||||
});
|
||||
zoomslider = new _ol_control_ZoomSlider_();
|
||||
zoomslider = new ZoomSlider();
|
||||
map.addControl(zoomslider);
|
||||
return map;
|
||||
};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* @module ol/control
|
||||
*/
|
||||
import _ol_Collection_ from './Collection.js';
|
||||
import _ol_control_Attribution_ from './control/Attribution.js';
|
||||
import _ol_control_Rotate_ from './control/Rotate.js';
|
||||
import _ol_control_Zoom_ from './control/Zoom.js';
|
||||
import Attribution from './control/Attribution.js';
|
||||
import Rotate from './control/Rotate.js';
|
||||
import Zoom from './control/Zoom.js';
|
||||
var _ol_control_ = {};
|
||||
|
||||
|
||||
@@ -28,18 +28,18 @@ _ol_control_.defaults = function(opt_options) {
|
||||
|
||||
var zoomControl = options.zoom !== undefined ? options.zoom : true;
|
||||
if (zoomControl) {
|
||||
controls.push(new _ol_control_Zoom_(options.zoomOptions));
|
||||
controls.push(new Zoom(options.zoomOptions));
|
||||
}
|
||||
|
||||
var rotateControl = options.rotate !== undefined ? options.rotate : true;
|
||||
if (rotateControl) {
|
||||
controls.push(new _ol_control_Rotate_(options.rotateOptions));
|
||||
controls.push(new Rotate(options.rotateOptions));
|
||||
}
|
||||
|
||||
var attributionControl = options.attribution !== undefined ?
|
||||
options.attribution : true;
|
||||
if (attributionControl) {
|
||||
controls.push(new _ol_control_Attribution_(options.attributionOptions));
|
||||
controls.push(new Attribution(options.attributionOptions));
|
||||
}
|
||||
|
||||
return controls;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {removeNode, replaceNode} from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -25,7 +25,7 @@ import _ol_obj_ from '../obj.js';
|
||||
* @param {olx.control.AttributionOptions=} opt_options Attribution options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_Attribution_ = function(opt_options) {
|
||||
var Attribution = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -110,9 +110,9 @@ var _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 : Attribution.render;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -139,7 +139,7 @@ var _ol_control_Attribution_ = function(opt_options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_Attribution_, _ol_control_Control_);
|
||||
inherits(Attribution, Control);
|
||||
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ inherits(_ol_control_Attribution_, _ol_control_Control_);
|
||||
* @return {Array.<string>} Attributions.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) {
|
||||
Attribution.prototype.getSourceAttributions_ = function(frameState) {
|
||||
/**
|
||||
* Used to determine if an attribution already exists.
|
||||
* @type {Object.<string, boolean>}
|
||||
@@ -208,7 +208,7 @@ _ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState)
|
||||
* @this {ol.control.Attribution}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Attribution_.render = function(mapEvent) {
|
||||
Attribution.render = function(mapEvent) {
|
||||
this.updateElement_(mapEvent.frameState);
|
||||
};
|
||||
|
||||
@@ -217,7 +217,7 @@ _ol_control_Attribution_.render = function(mapEvent) {
|
||||
* @private
|
||||
* @param {?olx.FrameState} frameState Frame state.
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.updateElement_ = function(frameState) {
|
||||
Attribution.prototype.updateElement_ = function(frameState) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
this.element.style.display = 'none';
|
||||
@@ -265,7 +265,7 @@ _ol_control_Attribution_.prototype.updateElement_ = function(frameState) {
|
||||
* @param {?olx.FrameState} frameState Frame state.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.insertLogos_ = function(frameState) {
|
||||
Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
|
||||
var logo;
|
||||
var logos = frameState.logos;
|
||||
@@ -309,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) {
|
||||
Attribution.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
};
|
||||
@@ -318,7 +318,7 @@ _ol_control_Attribution_.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.handleToggle_ = function() {
|
||||
Attribution.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
replaceNode(this.collapseLabel_, this.label_);
|
||||
@@ -334,7 +334,7 @@ _ol_control_Attribution_.prototype.handleToggle_ = function() {
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.getCollapsible = function() {
|
||||
Attribution.prototype.getCollapsible = function() {
|
||||
return this.collapsible_;
|
||||
};
|
||||
|
||||
@@ -344,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) {
|
||||
Attribution.prototype.setCollapsible = function(collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
@@ -363,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) {
|
||||
Attribution.prototype.setCollapsed = function(collapsed) {
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ _ol_control_Attribution_.prototype.setCollapsed = function(collapsed) {
|
||||
* @return {boolean} True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Attribution_.prototype.getCollapsed = function() {
|
||||
Attribution.prototype.getCollapsed = function() {
|
||||
return this.collapsed_;
|
||||
};
|
||||
export default _ol_control_Attribution_;
|
||||
export default Attribution;
|
||||
|
||||
@@ -36,7 +36,7 @@ import _ol_events_ from '../events.js';
|
||||
* @param {olx.control.ControlOptions} options Control options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_Control_ = function(options) {
|
||||
var Control = function(options) {
|
||||
|
||||
_ol_Object_.call(this);
|
||||
|
||||
@@ -75,13 +75,13 @@ var _ol_control_Control_ = function(options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_Control_, _ol_Object_);
|
||||
inherits(Control, _ol_Object_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_control_Control_.prototype.disposeInternal = function() {
|
||||
Control.prototype.disposeInternal = function() {
|
||||
removeNode(this.element);
|
||||
_ol_Object_.prototype.disposeInternal.call(this);
|
||||
};
|
||||
@@ -92,7 +92,7 @@ _ol_control_Control_.prototype.disposeInternal = function() {
|
||||
* @return {ol.PluggableMap} Map.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Control_.prototype.getMap = function() {
|
||||
Control.prototype.getMap = function() {
|
||||
return this.map_;
|
||||
};
|
||||
|
||||
@@ -105,7 +105,7 @@ _ol_control_Control_.prototype.getMap = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Control_.prototype.setMap = function(map) {
|
||||
Control.prototype.setMap = function(map) {
|
||||
if (this.map_) {
|
||||
removeNode(this.element);
|
||||
}
|
||||
@@ -136,9 +136,9 @@ _ol_control_Control_.prototype.setMap = function(map) {
|
||||
* @param {Element|string} target Target.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Control_.prototype.setTarget = function(target) {
|
||||
Control.prototype.setTarget = function(target) {
|
||||
this.target_ = typeof target === 'string' ?
|
||||
document.getElementById(target) :
|
||||
target;
|
||||
};
|
||||
export default _ol_control_Control_;
|
||||
export default Control;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/control/FullScreen
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {replaceNode} from '../dom.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -25,7 +25,7 @@ import _ol_events_EventType_ from '../events/EventType.js';
|
||||
* @param {olx.control.FullScreenOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_FullScreen_ = function(opt_options) {
|
||||
var FullScreen = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -56,7 +56,7 @@ var _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_ + '-' + FullScreen.isFullScreen();
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(this.labelNode_);
|
||||
@@ -66,12 +66,12 @@ var _ol_control_FullScreen_ = function(opt_options) {
|
||||
|
||||
var cssClasses = this.cssClassName_ + ' ' + _ol_css_.CLASS_UNSELECTABLE +
|
||||
' ' + _ol_css_.CLASS_CONTROL + ' ' +
|
||||
(!_ol_control_FullScreen_.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : '');
|
||||
(!FullScreen.isFullScreenSupported() ? _ol_css_.CLASS_UNSUPPORTED : '');
|
||||
var element = document.createElement('div');
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
@@ -90,14 +90,14 @@ var _ol_control_FullScreen_ = function(opt_options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_FullScreen_, _ol_control_Control_);
|
||||
inherits(FullScreen, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
_ol_control_FullScreen_.prototype.handleClick_ = function(event) {
|
||||
FullScreen.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleFullScreen_();
|
||||
};
|
||||
@@ -106,16 +106,16 @@ _ol_control_FullScreen_.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
|
||||
if (!_ol_control_FullScreen_.isFullScreenSupported()) {
|
||||
FullScreen.prototype.handleFullScreen_ = function() {
|
||||
if (!FullScreen.isFullScreenSupported()) {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
if (_ol_control_FullScreen_.isFullScreen()) {
|
||||
_ol_control_FullScreen_.exitFullScreen();
|
||||
if (FullScreen.isFullScreen()) {
|
||||
FullScreen.exitFullScreen();
|
||||
} else {
|
||||
var element;
|
||||
if (this.source_) {
|
||||
@@ -126,10 +126,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
|
||||
element = map.getTargetElement();
|
||||
}
|
||||
if (this.keys_) {
|
||||
_ol_control_FullScreen_.requestFullScreenWithKeys(element);
|
||||
FullScreen.requestFullScreenWithKeys(element);
|
||||
|
||||
} else {
|
||||
_ol_control_FullScreen_.requestFullScreen(element);
|
||||
FullScreen.requestFullScreen(element);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -138,10 +138,10 @@ _ol_control_FullScreen_.prototype.handleFullScreen_ = function() {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_FullScreen_.prototype.handleFullScreenChange_ = function() {
|
||||
FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
var button = this.element.firstElementChild;
|
||||
var map = this.getMap();
|
||||
if (_ol_control_FullScreen_.isFullScreen()) {
|
||||
if (FullScreen.isFullScreen()) {
|
||||
button.className = this.cssClassName_ + '-true';
|
||||
replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
} else {
|
||||
@@ -158,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);
|
||||
FullScreen.prototype.setMap = function(map) {
|
||||
Control.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
this.listenerKeys.push(_ol_events_.listen(document,
|
||||
_ol_control_FullScreen_.getChangeType_(),
|
||||
FullScreen.getChangeType_(),
|
||||
this.handleFullScreenChange_, this)
|
||||
);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ _ol_control_FullScreen_.prototype.setMap = function(map) {
|
||||
/**
|
||||
* @return {boolean} Fullscreen is supported by the current platform.
|
||||
*/
|
||||
_ol_control_FullScreen_.isFullScreenSupported = function() {
|
||||
FullScreen.isFullScreenSupported = function() {
|
||||
var body = document.body;
|
||||
return !!(
|
||||
body.webkitRequestFullscreen ||
|
||||
@@ -184,7 +184,7 @@ _ol_control_FullScreen_.isFullScreenSupported = function() {
|
||||
/**
|
||||
* @return {boolean} Element is currently in fullscreen.
|
||||
*/
|
||||
_ol_control_FullScreen_.isFullScreen = function() {
|
||||
FullScreen.isFullScreen = function() {
|
||||
return !!(
|
||||
document.webkitIsFullScreen || document.mozFullScreen ||
|
||||
document.msFullscreenElement || document.fullscreenElement
|
||||
@@ -195,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) {
|
||||
FullScreen.requestFullScreen = function(element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
} else if (element.msRequestFullscreen) {
|
||||
@@ -211,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) {
|
||||
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);
|
||||
FullScreen.requestFullScreen(element);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exit fullscreen.
|
||||
*/
|
||||
_ol_control_FullScreen_.exitFullScreen = function() {
|
||||
FullScreen.exitFullScreen = function() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.msExitFullscreen) {
|
||||
@@ -240,7 +240,7 @@ _ol_control_FullScreen_.exitFullScreen = function() {
|
||||
* @return {string} Change type.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_FullScreen_.getChangeType_ = (function() {
|
||||
FullScreen.getChangeType_ = (function() {
|
||||
var changeType;
|
||||
return function() {
|
||||
if (!changeType) {
|
||||
@@ -258,4 +258,4 @@ _ol_control_FullScreen_.getChangeType_ = (function() {
|
||||
return changeType;
|
||||
};
|
||||
})();
|
||||
export default _ol_control_FullScreen_;
|
||||
export default FullScreen;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {inherits} 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 Control from '../control/Control.js';
|
||||
import {getTransformFromProjections, identityTransform, get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ import {getTransformFromProjections, identityTransform, get as getProjection} fr
|
||||
* options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_MousePosition_ = function(opt_options) {
|
||||
var MousePosition = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -30,16 +30,16 @@ var _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 : MousePosition.render;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
_ol_events_.listen(this,
|
||||
_ol_Object_.getChangeEventType(_ol_control_MousePosition_.Property_.PROJECTION),
|
||||
_ol_Object_.getChangeEventType(MousePosition.Property_.PROJECTION),
|
||||
this.handleProjectionChanged_, this);
|
||||
|
||||
if (options.coordinateFormat) {
|
||||
@@ -81,7 +81,7 @@ var _ol_control_MousePosition_ = function(opt_options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_MousePosition_, _ol_control_Control_);
|
||||
inherits(MousePosition, Control);
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ inherits(_ol_control_MousePosition_, _ol_control_Control_);
|
||||
* @this {ol.control.MousePosition}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_MousePosition_.render = function(mapEvent) {
|
||||
MousePosition.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.mapProjection_ = null;
|
||||
@@ -107,7 +107,7 @@ _ol_control_MousePosition_.render = function(mapEvent) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.handleProjectionChanged_ = function() {
|
||||
MousePosition.prototype.handleProjectionChanged_ = function() {
|
||||
this.transform_ = null;
|
||||
};
|
||||
|
||||
@@ -120,9 +120,9 @@ _ol_control_MousePosition_.prototype.handleProjectionChanged_ = function() {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.getCoordinateFormat = function() {
|
||||
MousePosition.prototype.getCoordinateFormat = function() {
|
||||
return (
|
||||
/** @type {ol.CoordinateFormatType|undefined} */ this.get(_ol_control_MousePosition_.Property_.COORDINATE_FORMAT)
|
||||
/** @type {ol.CoordinateFormatType|undefined} */ this.get(MousePosition.Property_.COORDINATE_FORMAT)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -134,9 +134,9 @@ _ol_control_MousePosition_.prototype.getCoordinateFormat = function() {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.getProjection = function() {
|
||||
MousePosition.prototype.getProjection = function() {
|
||||
return (
|
||||
/** @type {ol.proj.Projection|undefined} */ this.get(_ol_control_MousePosition_.Property_.PROJECTION)
|
||||
/** @type {ol.proj.Projection|undefined} */ this.get(MousePosition.Property_.PROJECTION)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -145,7 +145,7 @@ _ol_control_MousePosition_.prototype.getProjection = function() {
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.handleMouseMove = function(event) {
|
||||
MousePosition.prototype.handleMouseMove = function(event) {
|
||||
var map = this.getMap();
|
||||
this.lastMouseMovePixel_ = map.getEventPixel(event);
|
||||
this.updateHTML_(this.lastMouseMovePixel_);
|
||||
@@ -156,7 +156,7 @@ _ol_control_MousePosition_.prototype.handleMouseMove = function(event) {
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.handleMouseOut = function(event) {
|
||||
MousePosition.prototype.handleMouseOut = function(event) {
|
||||
this.updateHTML_(null);
|
||||
this.lastMouseMovePixel_ = null;
|
||||
};
|
||||
@@ -166,8 +166,8 @@ _ol_control_MousePosition_.prototype.handleMouseOut = function(event) {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
MousePosition.prototype.setMap = function(map) {
|
||||
Control.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(
|
||||
@@ -187,8 +187,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);
|
||||
MousePosition.prototype.setCoordinateFormat = function(format) {
|
||||
this.set(MousePosition.Property_.COORDINATE_FORMAT, format);
|
||||
};
|
||||
|
||||
|
||||
@@ -199,8 +199,8 @@ _ol_control_MousePosition_.prototype.setCoordinateFormat = function(format) {
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.setProjection = function(projection) {
|
||||
this.set(_ol_control_MousePosition_.Property_.PROJECTION, getProjection(projection));
|
||||
MousePosition.prototype.setProjection = function(projection) {
|
||||
this.set(MousePosition.Property_.PROJECTION, getProjection(projection));
|
||||
};
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ _ol_control_MousePosition_.prototype.setProjection = function(projection) {
|
||||
* @param {?ol.Pixel} pixel Pixel.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_MousePosition_.prototype.updateHTML_ = function(pixel) {
|
||||
MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
var html = this.undefinedHTML_;
|
||||
if (pixel && this.mapProjection_) {
|
||||
if (!this.transform_) {
|
||||
@@ -243,8 +243,8 @@ _ol_control_MousePosition_.prototype.updateHTML_ = function(pixel) {
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
_ol_control_MousePosition_.Property_ = {
|
||||
MousePosition.Property_ = {
|
||||
PROJECTION: 'projection',
|
||||
COORDINATE_FORMAT: 'coordinateFormat'
|
||||
};
|
||||
export default _ol_control_MousePosition_;
|
||||
export default MousePosition;
|
||||
|
||||
@@ -11,7 +11,7 @@ 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 Control from '../control/Control.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {replaceNode} from '../dom.js';
|
||||
@@ -42,7 +42,7 @@ var MIN_RATIO = 0.1;
|
||||
* @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_OverviewMap_ = function(opt_options) {
|
||||
var OverviewMap = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -156,9 +156,9 @@ var _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 : OverviewMap.render;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -203,14 +203,14 @@ var _ol_control_OverviewMap_ = function(opt_options) {
|
||||
});
|
||||
};
|
||||
|
||||
inherits(_ol_control_OverviewMap_, _ol_control_Control_);
|
||||
inherits(OverviewMap, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.setMap = function(map) {
|
||||
OverviewMap.prototype.setMap = function(map) {
|
||||
var oldMap = this.getMap();
|
||||
if (map === oldMap) {
|
||||
return;
|
||||
@@ -222,7 +222,7 @@ _ol_control_OverviewMap_.prototype.setMap = function(map) {
|
||||
}
|
||||
this.ovmap_.setTarget(null);
|
||||
}
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
Control.prototype.setMap.call(this, map);
|
||||
|
||||
if (map) {
|
||||
this.ovmap_.setTarget(this.ovmapDiv_);
|
||||
@@ -252,7 +252,7 @@ _ol_control_OverviewMap_.prototype.setMap = function(map) {
|
||||
* @param {ol.Object.Event} event The propertychange event.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.handleMapPropertyChange_ = function(event) {
|
||||
OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
||||
if (event.key === _ol_MapProperty_.VIEW) {
|
||||
var oldView = /** @type {ol.View} */ (event.oldValue);
|
||||
if (oldView) {
|
||||
@@ -269,7 +269,7 @@ _ol_control_OverviewMap_.prototype.handleMapPropertyChange_ = function(event) {
|
||||
* @param {ol.View} view The view.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.bindView_ = function(view) {
|
||||
OverviewMap.prototype.bindView_ = function(view) {
|
||||
_ol_events_.listen(view,
|
||||
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
|
||||
this.handleRotationChanged_, this);
|
||||
@@ -281,7 +281,7 @@ _ol_control_OverviewMap_.prototype.bindView_ = function(view) {
|
||||
* @param {ol.View} view The view.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.unbindView_ = function(view) {
|
||||
OverviewMap.prototype.unbindView_ = function(view) {
|
||||
_ol_events_.unlisten(view,
|
||||
_ol_Object_.getChangeEventType(_ol_ViewProperty_.ROTATION),
|
||||
this.handleRotationChanged_, this);
|
||||
@@ -294,7 +294,7 @@ _ol_control_OverviewMap_.prototype.unbindView_ = function(view) {
|
||||
* overview map's view.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.handleRotationChanged_ = function() {
|
||||
OverviewMap.prototype.handleRotationChanged_ = function() {
|
||||
this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());
|
||||
};
|
||||
|
||||
@@ -305,7 +305,7 @@ _ol_control_OverviewMap_.prototype.handleRotationChanged_ = function() {
|
||||
* @this {ol.control.OverviewMap}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.render = function(mapEvent) {
|
||||
OverviewMap.render = function(mapEvent) {
|
||||
this.validateExtent_();
|
||||
this.updateBox_();
|
||||
};
|
||||
@@ -322,7 +322,7 @@ _ol_control_OverviewMap_.render = function(mapEvent) {
|
||||
* main map center location.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.validateExtent_ = function() {
|
||||
OverviewMap.prototype.validateExtent_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -367,7 +367,7 @@ _ol_control_OverviewMap_.prototype.validateExtent_ = function() {
|
||||
* the extent of the main map.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.resetExtent_ = function() {
|
||||
OverviewMap.prototype.resetExtent_ = function() {
|
||||
if (MAX_RATIO === 0 || MIN_RATIO === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ _ol_control_OverviewMap_.prototype.resetExtent_ = function() {
|
||||
* resolution.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.recenter_ = function() {
|
||||
OverviewMap.prototype.recenter_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -414,7 +414,7 @@ _ol_control_OverviewMap_.prototype.recenter_ = function() {
|
||||
* Update the box using the main map extent
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.updateBox_ = function() {
|
||||
OverviewMap.prototype.updateBox_ = function() {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
|
||||
@@ -455,7 +455,7 @@ _ol_control_OverviewMap_.prototype.updateBox_ = function() {
|
||||
* @return {ol.Coordinate|undefined} Coordinate for rotation and center anchor.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.calculateCoordinateRotate_ = function(
|
||||
OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
rotation, coordinate) {
|
||||
var coordinateRotate;
|
||||
|
||||
@@ -480,7 +480,7 @@ _ol_control_OverviewMap_.prototype.calculateCoordinateRotate_ = function(
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.handleClick_ = function(event) {
|
||||
OverviewMap.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
};
|
||||
@@ -489,7 +489,7 @@ _ol_control_OverviewMap_.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.handleToggle_ = function() {
|
||||
OverviewMap.prototype.handleToggle_ = function() {
|
||||
this.element.classList.toggle('ol-collapsed');
|
||||
if (this.collapsed_) {
|
||||
replaceNode(this.collapseLabel_, this.label_);
|
||||
@@ -518,7 +518,7 @@ _ol_control_OverviewMap_.prototype.handleToggle_ = function() {
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.getCollapsible = function() {
|
||||
OverviewMap.prototype.getCollapsible = function() {
|
||||
return this.collapsible_;
|
||||
};
|
||||
|
||||
@@ -528,7 +528,7 @@ _ol_control_OverviewMap_.prototype.getCollapsible = function() {
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.setCollapsible = function(collapsible) {
|
||||
OverviewMap.prototype.setCollapsible = function(collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
@@ -547,7 +547,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) {
|
||||
OverviewMap.prototype.setCollapsed = function(collapsed) {
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ _ol_control_OverviewMap_.prototype.setCollapsed = function(collapsed) {
|
||||
* @return {boolean} The overview map is collapsed.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.getCollapsed = function() {
|
||||
OverviewMap.prototype.getCollapsed = function() {
|
||||
return this.collapsed_;
|
||||
};
|
||||
|
||||
@@ -570,7 +570,7 @@ _ol_control_OverviewMap_.prototype.getCollapsed = function() {
|
||||
* @return {ol.PluggableMap} Overview map.
|
||||
* @api
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.getOverviewMap = function() {
|
||||
OverviewMap.prototype.getOverviewMap = function() {
|
||||
return this.ovmap_;
|
||||
};
|
||||
export default _ol_control_OverviewMap_;
|
||||
export default OverviewMap;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/control/Rotate
|
||||
*/
|
||||
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -20,7 +20,7 @@ import {inherits} from '../index.js';
|
||||
* @param {olx.control.RotateOptions=} opt_options Rotate options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_Rotate_ = function(opt_options) {
|
||||
var Rotate = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -52,7 +52,7 @@ var _ol_control_Rotate_ = function(opt_options) {
|
||||
button.appendChild(this.label_);
|
||||
|
||||
_ol_events_.listen(button, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Rotate_.prototype.handleClick_, this);
|
||||
Rotate.prototype.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL;
|
||||
@@ -60,11 +60,11 @@ var _ol_control_Rotate_ = function(opt_options) {
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
var render = options.render ? options.render : _ol_control_Rotate_.render;
|
||||
var render = options.render ? options.render : Rotate.render;
|
||||
|
||||
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
render: render,
|
||||
target: options.target
|
||||
@@ -94,14 +94,14 @@ var _ol_control_Rotate_ = function(opt_options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_Rotate_, _ol_control_Control_);
|
||||
inherits(Rotate, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Rotate_.prototype.handleClick_ = function(event) {
|
||||
Rotate.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
if (this.callResetNorth_ !== undefined) {
|
||||
this.callResetNorth_();
|
||||
@@ -114,7 +114,7 @@ _ol_control_Rotate_.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Rotate_.prototype.resetNorth_ = function() {
|
||||
Rotate.prototype.resetNorth_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
@@ -142,7 +142,7 @@ _ol_control_Rotate_.prototype.resetNorth_ = function() {
|
||||
* @this {ol.control.Rotate}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_Rotate_.render = function(mapEvent) {
|
||||
Rotate.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
return;
|
||||
@@ -164,4 +164,4 @@ _ol_control_Rotate_.render = function(mapEvent) {
|
||||
}
|
||||
this.rotation_ = rotation;
|
||||
};
|
||||
export default _ol_control_Rotate_;
|
||||
export default Rotate;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import {inherits} 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 Control from '../control/Control.js';
|
||||
import ScaleLineUnits from '../control/ScaleLineUnits.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
import {getPointResolution, METERS_PER_UNIT} from '../proj.js';
|
||||
@@ -26,7 +26,7 @@ import _ol_proj_Units_ from '../proj/Units.js';
|
||||
* @param {olx.control.ScaleLineOptions=} opt_options Scale line options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_ScaleLine_ = function(opt_options) {
|
||||
var ScaleLine = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -77,31 +77,31 @@ var _ol_control_ScaleLine_ = function(opt_options) {
|
||||
*/
|
||||
this.renderedHTML_ = '';
|
||||
|
||||
var render = options.render ? options.render : _ol_control_ScaleLine_.render;
|
||||
var render = options.render ? options.render : ScaleLine.render;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: this.element_,
|
||||
render: render,
|
||||
target: options.target
|
||||
});
|
||||
|
||||
_ol_events_.listen(
|
||||
this, _ol_Object_.getChangeEventType(_ol_control_ScaleLine_.Property_.UNITS),
|
||||
this, _ol_Object_.getChangeEventType(ScaleLine.Property_.UNITS),
|
||||
this.handleUnitsChanged_, this);
|
||||
|
||||
this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) ||
|
||||
_ol_control_ScaleLineUnits_.METRIC);
|
||||
ScaleLineUnits.METRIC);
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_ScaleLine_, _ol_control_Control_);
|
||||
inherits(ScaleLine, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array.<number>}
|
||||
*/
|
||||
_ol_control_ScaleLine_.LEADING_DIGITS = [1, 2, 5];
|
||||
ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
||||
|
||||
|
||||
/**
|
||||
@@ -111,9 +111,9 @@ _ol_control_ScaleLine_.LEADING_DIGITS = [1, 2, 5];
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
_ol_control_ScaleLine_.prototype.getUnits = function() {
|
||||
ScaleLine.prototype.getUnits = function() {
|
||||
return (
|
||||
/** @type {ol.control.ScaleLineUnits|undefined} */ this.get(_ol_control_ScaleLine_.Property_.UNITS)
|
||||
/** @type {ol.control.ScaleLineUnits|undefined} */ this.get(ScaleLine.Property_.UNITS)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ _ol_control_ScaleLine_.prototype.getUnits = function() {
|
||||
* @this {ol.control.ScaleLine}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_ScaleLine_.render = function(mapEvent) {
|
||||
ScaleLine.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.viewState_ = null;
|
||||
@@ -138,7 +138,7 @@ _ol_control_ScaleLine_.render = function(mapEvent) {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ScaleLine_.prototype.handleUnitsChanged_ = function() {
|
||||
ScaleLine.prototype.handleUnitsChanged_ = function() {
|
||||
this.updateElement_();
|
||||
};
|
||||
|
||||
@@ -149,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);
|
||||
ScaleLine.prototype.setUnits = function(units) {
|
||||
this.set(ScaleLine.Property_.UNITS, units);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
ScaleLine.prototype.updateElement_ = function() {
|
||||
var viewState = this.viewState_;
|
||||
|
||||
if (!viewState) {
|
||||
@@ -171,18 +171,18 @@ _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 ?
|
||||
var pointResolutionUnits = units == ScaleLineUnits.DEGREES ?
|
||||
_ol_proj_Units_.DEGREES :
|
||||
_ol_proj_Units_.METERS;
|
||||
var pointResolution =
|
||||
getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
||||
if (units != _ol_control_ScaleLineUnits_.DEGREES) {
|
||||
if (units != ScaleLineUnits.DEGREES) {
|
||||
pointResolution *= projection.getMetersPerUnit();
|
||||
}
|
||||
|
||||
var nominalCount = this.minWidth_ * pointResolution;
|
||||
var suffix = '';
|
||||
if (units == _ol_control_ScaleLineUnits_.DEGREES) {
|
||||
if (units == ScaleLineUnits.DEGREES) {
|
||||
var metersPerDegree = METERS_PER_UNIT[_ol_proj_Units_.DEGREES];
|
||||
if (projection.getUnits() == _ol_proj_Units_.DEGREES) {
|
||||
nominalCount *= metersPerDegree;
|
||||
@@ -198,7 +198,7 @@ _ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
} else {
|
||||
suffix = '\u00b0'; // degrees
|
||||
}
|
||||
} else if (units == _ol_control_ScaleLineUnits_.IMPERIAL) {
|
||||
} else if (units == ScaleLineUnits.IMPERIAL) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution /= 0.0254;
|
||||
@@ -209,10 +209,10 @@ _ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
suffix = 'mi';
|
||||
pointResolution /= 1609.344;
|
||||
}
|
||||
} else if (units == _ol_control_ScaleLineUnits_.NAUTICAL) {
|
||||
} else if (units == ScaleLineUnits.NAUTICAL) {
|
||||
pointResolution /= 1852;
|
||||
suffix = 'nm';
|
||||
} else if (units == _ol_control_ScaleLineUnits_.METRIC) {
|
||||
} else if (units == ScaleLineUnits.METRIC) {
|
||||
if (nominalCount < 0.001) {
|
||||
suffix = 'μm';
|
||||
pointResolution *= 1000000;
|
||||
@@ -225,7 +225,7 @@ _ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
suffix = 'km';
|
||||
pointResolution /= 1000;
|
||||
}
|
||||
} else if (units == _ol_control_ScaleLineUnits_.US) {
|
||||
} else if (units == ScaleLineUnits.US) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution *= 39.37;
|
||||
@@ -244,7 +244,7 @@ _ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
|
||||
var count, width;
|
||||
while (true) {
|
||||
count = _ol_control_ScaleLine_.LEADING_DIGITS[((i % 3) + 3) % 3] *
|
||||
count = ScaleLine.LEADING_DIGITS[((i % 3) + 3) % 3] *
|
||||
Math.pow(10, Math.floor(i / 3));
|
||||
width = Math.round(count / pointResolution);
|
||||
if (isNaN(width)) {
|
||||
@@ -280,7 +280,7 @@ _ol_control_ScaleLine_.prototype.updateElement_ = function() {
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ScaleLine_.Property_ = {
|
||||
ScaleLine.Property_ = {
|
||||
UNITS: 'units'
|
||||
};
|
||||
export default _ol_control_ScaleLine_;
|
||||
export default ScaleLine;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
/**
|
||||
* @module ol/control/ScaleLineUnits
|
||||
*/
|
||||
|
||||
/**
|
||||
* Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
|
||||
* `'nautical'`, `'metric'`, `'us'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
var _ol_control_ScaleLineUnits_ = {
|
||||
export default {
|
||||
DEGREES: 'degrees',
|
||||
IMPERIAL: 'imperial',
|
||||
NAUTICAL: 'nautical',
|
||||
METRIC: 'metric',
|
||||
US: 'us'
|
||||
};
|
||||
|
||||
export default _ol_control_ScaleLineUnits_;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} 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 Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
|
||||
@@ -19,7 +19,7 @@ import {easeOut} from '../easing.js';
|
||||
* @param {olx.control.ZoomOptions=} opt_options Zoom options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_Zoom_ = function(opt_options) {
|
||||
var Zoom = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -44,7 +44,7 @@ var _ol_control_Zoom_ = function(opt_options) {
|
||||
);
|
||||
|
||||
_ol_events_.listen(inElement, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Zoom_.prototype.handleClick_.bind(this, delta));
|
||||
Zoom.prototype.handleClick_.bind(this, delta));
|
||||
|
||||
var outElement = document.createElement('button');
|
||||
outElement.className = className + '-out';
|
||||
@@ -55,7 +55,7 @@ var _ol_control_Zoom_ = function(opt_options) {
|
||||
);
|
||||
|
||||
_ol_events_.listen(outElement, _ol_events_EventType_.CLICK,
|
||||
_ol_control_Zoom_.prototype.handleClick_.bind(this, -delta));
|
||||
Zoom.prototype.handleClick_.bind(this, -delta));
|
||||
|
||||
var cssClasses = className + ' ' + _ol_css_.CLASS_UNSELECTABLE + ' ' +
|
||||
_ol_css_.CLASS_CONTROL;
|
||||
@@ -64,7 +64,7 @@ var _ol_control_Zoom_ = function(opt_options) {
|
||||
element.appendChild(inElement);
|
||||
element.appendChild(outElement);
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
@@ -77,7 +77,7 @@ var _ol_control_Zoom_ = function(opt_options) {
|
||||
|
||||
};
|
||||
|
||||
inherits(_ol_control_Zoom_, _ol_control_Control_);
|
||||
inherits(Zoom, Control);
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ inherits(_ol_control_Zoom_, _ol_control_Control_);
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Zoom_.prototype.handleClick_ = function(delta, event) {
|
||||
Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
event.preventDefault();
|
||||
this.zoomByDelta_(delta);
|
||||
};
|
||||
@@ -95,7 +95,7 @@ _ol_control_Zoom_.prototype.handleClick_ = function(delta, event) {
|
||||
* @param {number} delta Zoom delta.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_Zoom_.prototype.zoomByDelta_ = function(delta) {
|
||||
Zoom.prototype.zoomByDelta_ = function(delta) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
@@ -120,4 +120,4 @@ _ol_control_Zoom_.prototype.zoomByDelta_ = function(delta) {
|
||||
}
|
||||
}
|
||||
};
|
||||
export default _ol_control_Zoom_;
|
||||
export default Zoom;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ViewHint_ from '../ViewHint.js';
|
||||
import _ol_control_Control_ from '../control/Control.js';
|
||||
import Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -28,7 +28,7 @@ import _ol_pointer_PointerEventHandler_ from '../pointer/PointerEventHandler.js'
|
||||
* @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_ZoomSlider_ = function(opt_options) {
|
||||
var ZoomSlider = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -47,7 +47,7 @@ var _ol_control_ZoomSlider_ = function(opt_options) {
|
||||
* @type {ol.control.ZoomSlider.Direction_}
|
||||
* @private
|
||||
*/
|
||||
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
|
||||
this.direction_ = ZoomSlider.Direction_.VERTICAL;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
@@ -125,23 +125,23 @@ var _ol_control_ZoomSlider_ = function(opt_options) {
|
||||
_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 : ZoomSlider.render;
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: containerElement,
|
||||
render: render
|
||||
});
|
||||
};
|
||||
|
||||
inherits(_ol_control_ZoomSlider_, _ol_control_Control_);
|
||||
inherits(ZoomSlider, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.disposeInternal = function() {
|
||||
ZoomSlider.prototype.disposeInternal = function() {
|
||||
this.dragger_.dispose();
|
||||
_ol_control_Control_.prototype.disposeInternal.call(this);
|
||||
Control.prototype.disposeInternal.call(this);
|
||||
};
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ _ol_control_ZoomSlider_.prototype.disposeInternal = function() {
|
||||
* @enum {number}
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.Direction_ = {
|
||||
ZoomSlider.Direction_ = {
|
||||
VERTICAL: 0,
|
||||
HORIZONTAL: 1
|
||||
};
|
||||
@@ -160,8 +160,8 @@ _ol_control_ZoomSlider_.Direction_ = {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.setMap = function(map) {
|
||||
_ol_control_Control_.prototype.setMap.call(this, map);
|
||||
ZoomSlider.prototype.setMap = function(map) {
|
||||
Control.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
map.render();
|
||||
}
|
||||
@@ -175,7 +175,7 @@ _ol_control_ZoomSlider_.prototype.setMap = function(map) {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.initSlider_ = function() {
|
||||
ZoomSlider.prototype.initSlider_ = function() {
|
||||
var container = this.element;
|
||||
var containerSize = {
|
||||
width: container.offsetWidth, height: container.offsetHeight
|
||||
@@ -192,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_ = ZoomSlider.Direction_.HORIZONTAL;
|
||||
this.widthLimit_ = containerSize.width - thumbWidth;
|
||||
} else {
|
||||
this.direction_ = _ol_control_ZoomSlider_.Direction_.VERTICAL;
|
||||
this.direction_ = ZoomSlider.Direction_.VERTICAL;
|
||||
this.heightLimit_ = containerSize.height - thumbHeight;
|
||||
}
|
||||
this.sliderInitialized_ = true;
|
||||
@@ -208,7 +208,7 @@ _ol_control_ZoomSlider_.prototype.initSlider_ = function() {
|
||||
* @this {ol.control.ZoomSlider}
|
||||
* @api
|
||||
*/
|
||||
_ol_control_ZoomSlider_.render = function(mapEvent) {
|
||||
ZoomSlider.render = function(mapEvent) {
|
||||
if (!mapEvent.frameState) {
|
||||
return;
|
||||
}
|
||||
@@ -227,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) {
|
||||
ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
var view = this.getMap().getView();
|
||||
|
||||
var relativePosition = this.getRelativePosition_(
|
||||
@@ -249,7 +249,7 @@ _ol_control_ZoomSlider_.prototype.handleContainerClick_ = function(event) {
|
||||
* @param {ol.pointer.PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.handleDraggerStart_ = function(event) {
|
||||
ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
||||
if (!this.dragging_ && event.originalEvent.target === this.element.firstElementChild) {
|
||||
this.getMap().getView().setHint(_ol_ViewHint_.INTERACTING, 1);
|
||||
this.previousX_ = event.clientX;
|
||||
@@ -265,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) {
|
||||
ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
|
||||
if (this.dragging_) {
|
||||
var element = this.element.firstElementChild;
|
||||
var deltaX = event.clientX - this.previousX_ + parseInt(element.style.left, 10);
|
||||
@@ -285,7 +285,7 @@ _ol_control_ZoomSlider_.prototype.handleDraggerDrag_ = function(event) {
|
||||
* @param {ol.pointer.PointerEvent|Event} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.handleDraggerEnd_ = function(event) {
|
||||
ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||
if (this.dragging_) {
|
||||
var view = this.getMap().getView();
|
||||
view.setHint(_ol_ViewHint_.INTERACTING, -1);
|
||||
@@ -309,11 +309,11 @@ _ol_control_ZoomSlider_.prototype.handleDraggerEnd_ = function(event) {
|
||||
* @param {number} res The res.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.setThumbPosition_ = function(res) {
|
||||
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_ == ZoomSlider.Direction_.HORIZONTAL) {
|
||||
thumb.style.left = this.widthLimit_ * position + 'px';
|
||||
} else {
|
||||
thumb.style.top = this.heightLimit_ * position + 'px';
|
||||
@@ -331,9 +331,9 @@ _ol_control_ZoomSlider_.prototype.setThumbPosition_ = function(res) {
|
||||
* @return {number} The relative position of the thumb.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.getRelativePosition_ = function(x, y) {
|
||||
ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
||||
var amount;
|
||||
if (this.direction_ === _ol_control_ZoomSlider_.Direction_.HORIZONTAL) {
|
||||
if (this.direction_ === ZoomSlider.Direction_.HORIZONTAL) {
|
||||
amount = x / this.widthLimit_;
|
||||
} else {
|
||||
amount = y / this.heightLimit_;
|
||||
@@ -350,7 +350,7 @@ _ol_control_ZoomSlider_.prototype.getRelativePosition_ = function(x, y) {
|
||||
* @return {number} The corresponding resolution.
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomSlider_.prototype.getResolutionForPosition_ = function(position) {
|
||||
ZoomSlider.prototype.getResolutionForPosition_ = function(position) {
|
||||
var fn = this.getMap().getView().getResolutionForValueFunction();
|
||||
return fn(1 - position);
|
||||
};
|
||||
@@ -365,8 +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) {
|
||||
ZoomSlider.prototype.getPositionForResolution_ = function(res) {
|
||||
var fn = this.getMap().getView().getValueForResolutionFunction();
|
||||
return 1 - fn(res);
|
||||
};
|
||||
export default _ol_control_ZoomSlider_;
|
||||
export default ZoomSlider;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {inherits} 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 Control from '../control/Control.js';
|
||||
import _ol_css_ from '../css.js';
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ import _ol_css_ from '../css.js';
|
||||
* @param {olx.control.ZoomToExtentOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
var _ol_control_ZoomToExtent_ = function(opt_options) {
|
||||
var ZoomToExtent = function(opt_options) {
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
@@ -48,20 +48,20 @@ var _ol_control_ZoomToExtent_ = function(opt_options) {
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
|
||||
_ol_control_Control_.call(this, {
|
||||
Control.call(this, {
|
||||
element: element,
|
||||
target: options.target
|
||||
});
|
||||
};
|
||||
|
||||
inherits(_ol_control_ZoomToExtent_, _ol_control_Control_);
|
||||
inherits(ZoomToExtent, Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
_ol_control_ZoomToExtent_.prototype.handleClick_ = function(event) {
|
||||
ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
event.preventDefault();
|
||||
this.handleZoomToExtent();
|
||||
};
|
||||
@@ -70,10 +70,10 @@ _ol_control_ZoomToExtent_.prototype.handleClick_ = function(event) {
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
_ol_control_ZoomToExtent_.prototype.handleZoomToExtent = function() {
|
||||
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_;
|
||||
export default ZoomToExtent;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_Tile_ from '../../../../src/ol/Tile.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_control_Attribution_ from '../../../../src/ol/control/Attribution.js';
|
||||
import Attribution from '../../../../src/ol/control/Attribution.js';
|
||||
import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
|
||||
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
@@ -15,7 +15,7 @@ describe('ol.control.Attribution', function() {
|
||||
document.body.appendChild(target);
|
||||
map = new _ol_Map_({
|
||||
target: target,
|
||||
controls: [new _ol_control_Attribution_({
|
||||
controls: [new Attribution({
|
||||
collapsed: false,
|
||||
collapsible: false
|
||||
})],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_control_Control_ from '../../../../src/ol/control/Control.js';
|
||||
import Control from '../../../../src/ol/control/Control.js';
|
||||
|
||||
describe('ol.control.Control', function() {
|
||||
var map, control;
|
||||
@@ -9,7 +9,7 @@ describe('ol.control.Control', function() {
|
||||
target: document.createElement('div')
|
||||
});
|
||||
var element = document.createElement('DIV');
|
||||
control = new _ol_control_Control_({element: element});
|
||||
control = new Control({element: element});
|
||||
control.setMap(map);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('ol.control.Control\'s target', function() {
|
||||
var target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
var ctrl = new _ol_control_Control_({target: 'mycontrol'});
|
||||
var ctrl = new Control({target: 'mycontrol'});
|
||||
expect(ctrl.target_.id).to.equal('mycontrol');
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
@@ -42,13 +42,13 @@ describe('ol.control.Control\'s target', function() {
|
||||
var target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
var ctrl = new _ol_control_Control_({target: target});
|
||||
var ctrl = new Control({target: target});
|
||||
expect(ctrl.target_.id).to.equal('mycontrol');
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
});
|
||||
it('ignores non-existing target id', function() {
|
||||
var ctrl = new _ol_control_Control_({target: 'doesnotexist'});
|
||||
var ctrl = new Control({target: 'doesnotexist'});
|
||||
expect(ctrl.target_).to.equal(null);
|
||||
ctrl.dispose();
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_control_FullScreen_ from '../../../../src/ol/control/FullScreen.js';
|
||||
import FullScreen from '../../../../src/ol/control/FullScreen.js';
|
||||
|
||||
describe('ol.control.FullScreen', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new _ol_control_FullScreen_();
|
||||
expect(instance).to.be.an(_ol_control_FullScreen_);
|
||||
var instance = new FullScreen();
|
||||
expect(instance).to.be.an(FullScreen);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import _ol_control_MousePosition_ from '../../../../src/ol/control/MousePosition.js';
|
||||
import MousePosition from '../../../../src/ol/control/MousePosition.js';
|
||||
|
||||
describe('ol.control.MousePosition', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new _ol_control_MousePosition_();
|
||||
expect(instance).to.be.an(_ol_control_MousePosition_);
|
||||
var instance = new MousePosition();
|
||||
expect(instance).to.be.an(MousePosition);
|
||||
expect(instance.element.className).to.be('ol-mouse-position');
|
||||
});
|
||||
|
||||
it('creates the element with the provided class name', function() {
|
||||
var className = 'foobar';
|
||||
var instance = new _ol_control_MousePosition_({
|
||||
var instance = new MousePosition({
|
||||
className: className
|
||||
});
|
||||
expect(instance.element.className).to.be(className);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_control_Control_ from '../../../../src/ol/control/Control.js';
|
||||
import _ol_control_OverviewMap_ from '../../../../src/ol/control/OverviewMap.js';
|
||||
import Control from '../../../../src/ol/control/Control.js';
|
||||
import OverviewMap from '../../../../src/ol/control/OverviewMap.js';
|
||||
|
||||
describe('ol.control.OverviewMap', function() {
|
||||
var map, target;
|
||||
@@ -23,9 +23,9 @@ describe('ol.control.OverviewMap', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('creates an overview map with the default options', function() {
|
||||
var control = new _ol_control_OverviewMap_();
|
||||
expect(control).to.be.a(_ol_control_OverviewMap_);
|
||||
expect(control).to.be.a(_ol_control_Control_);
|
||||
var control = new OverviewMap();
|
||||
expect(control).to.be.a(OverviewMap);
|
||||
expect(control).to.be.a(Control);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('ol.control.OverviewMap', function() {
|
||||
});
|
||||
map.setView(view);
|
||||
|
||||
var control = new _ol_control_OverviewMap_();
|
||||
var control = new OverviewMap();
|
||||
map.addControl(control);
|
||||
var ovView = control.ovmap_.getView();
|
||||
expect(ovView.getRotation()).to.be(0);
|
||||
@@ -49,7 +49,7 @@ describe('ol.control.OverviewMap', function() {
|
||||
});
|
||||
|
||||
it('maintains rotation in sync if view added later', function() {
|
||||
var control = new _ol_control_OverviewMap_();
|
||||
var control = new OverviewMap();
|
||||
map.addControl(control);
|
||||
var ovView = control.ovmap_.getView();
|
||||
expect(ovView.getRotation()).to.be(0);
|
||||
@@ -65,7 +65,7 @@ describe('ol.control.OverviewMap', function() {
|
||||
});
|
||||
|
||||
it('stops listening to old maps', function() {
|
||||
var control = new _ol_control_OverviewMap_();
|
||||
var control = new OverviewMap();
|
||||
var ovView = control.ovmap_.getView();
|
||||
|
||||
var view = new _ol_View_({
|
||||
@@ -86,7 +86,7 @@ describe('ol.control.OverviewMap', function() {
|
||||
});
|
||||
|
||||
it('set target to null', function() {
|
||||
var control = new _ol_control_OverviewMap_();
|
||||
var control = new OverviewMap();
|
||||
|
||||
map.addControl(control);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_control_Rotate_ from '../../../../src/ol/control/Rotate.js';
|
||||
import Rotate from '../../../../src/ol/control/Rotate.js';
|
||||
|
||||
describe('ol.control.Rotate', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new _ol_control_Rotate_();
|
||||
expect(instance).to.be.an(_ol_control_Rotate_);
|
||||
var instance = new Rotate();
|
||||
expect(instance).to.be.an(Rotate);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_control_ScaleLine_ from '../../../../src/ol/control/ScaleLine.js';
|
||||
import ScaleLine from '../../../../src/ol/control/ScaleLine.js';
|
||||
import {fromLonLat} from '../../../../src/ol/proj.js';
|
||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||
|
||||
@@ -20,8 +20,8 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('can be constructed without arguments', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
expect(ctrl).to.be.an(_ol_control_ScaleLine_);
|
||||
var ctrl = new ScaleLine();
|
||||
expect(ctrl).to.be.an(ScaleLine);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,14 +29,14 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('className', function() {
|
||||
it('defaults to "ol-scale-line"', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
ctrl.setMap(map);
|
||||
var element = document.querySelector('.ol-scale-line', map.getTarget());
|
||||
expect(element).to.not.be(null);
|
||||
expect(element).to.be.a(HTMLDivElement);
|
||||
});
|
||||
it('can be configured', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
className: 'humpty-dumpty'
|
||||
});
|
||||
ctrl.setMap(map);
|
||||
@@ -53,11 +53,11 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('minWidth', function() {
|
||||
it('defaults to 64', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
expect(ctrl.minWidth_).to.be(64);
|
||||
});
|
||||
it('can be configured', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
minWidth: 4711
|
||||
});
|
||||
expect(ctrl.minWidth_).to.be(4711);
|
||||
@@ -66,14 +66,14 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('render', function() {
|
||||
it('defaults to `ol.control.ScaleLine.render`', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
expect(ctrl.render).to.be(_ol_control_ScaleLine_.render);
|
||||
var ctrl = new ScaleLine();
|
||||
expect(ctrl.render).to.be(ScaleLine.render);
|
||||
});
|
||||
it('can be configured', function() {
|
||||
var myRender = function() {
|
||||
|
||||
};
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
render: myRender
|
||||
});
|
||||
expect(ctrl.render).to.be(myRender);
|
||||
@@ -85,7 +85,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
describe('synchronisation with map view', function() {
|
||||
it('calls `render` as soon as the map is rendered', function(done) {
|
||||
var renderSpy = sinon.spy();
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
render: renderSpy
|
||||
});
|
||||
expect(renderSpy.called).to.be(false);
|
||||
@@ -104,7 +104,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
});
|
||||
it('calls `render` as often as the map is rendered', function() {
|
||||
var renderSpy = sinon.spy();
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
render: renderSpy
|
||||
});
|
||||
ctrl.setMap(map);
|
||||
@@ -121,7 +121,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
});
|
||||
it('calls `render` as when the view changes', function(done) {
|
||||
var renderSpy = sinon.spy();
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
render: renderSpy
|
||||
});
|
||||
ctrl.setMap(map);
|
||||
@@ -140,7 +140,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('static method `render`', function() {
|
||||
it('updates the rendered text', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
expect(ctrl.element.innerText).to.be('');
|
||||
ctrl.setMap(map);
|
||||
map.setView(new _ol_View_({
|
||||
@@ -154,17 +154,17 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('#getUnits', function() {
|
||||
it('returns "metric" by default', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
expect(ctrl.getUnits()).to.be('metric');
|
||||
});
|
||||
it('returns what is configured via `units` property', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
units: 'nautical'
|
||||
});
|
||||
expect(ctrl.getUnits()).to.be('nautical');
|
||||
});
|
||||
it('returns what is configured `setUnits` method', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
ctrl.setUnits('nautical');
|
||||
expect(ctrl.getUnits()).to.be('nautical');
|
||||
});
|
||||
@@ -172,7 +172,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('#setUnits', function() {
|
||||
it('triggers rerendering', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
map.setView(new _ol_View_({
|
||||
center: [0, 0],
|
||||
zoom: 0
|
||||
@@ -196,7 +196,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
var imperialHtml;
|
||||
var usHtml;
|
||||
beforeEach(function(done) {
|
||||
ctrl = new _ol_control_ScaleLine_();
|
||||
ctrl = new ScaleLine();
|
||||
ctrl.setMap(map);
|
||||
map.setView(new _ol_View_({
|
||||
center: [0, 0],
|
||||
@@ -246,7 +246,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('projections affect the scaleline', function() {
|
||||
it('is rendered differently for different projections', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
ctrl.setMap(map);
|
||||
map.setView(new _ol_View_({
|
||||
center: fromLonLat([7, 52]),
|
||||
@@ -266,7 +266,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
});
|
||||
|
||||
it('Projection\'s metersPerUnit affect scale for non-degree units', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
ctrl.setMap(map);
|
||||
map.setView(new _ol_View_({
|
||||
center: [0, 0],
|
||||
@@ -303,7 +303,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
describe('latitude may affect scale line in EPSG:4326', function() {
|
||||
|
||||
it('is rendered differently at different latitudes for metric', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_();
|
||||
var ctrl = new ScaleLine();
|
||||
ctrl.setMap(map);
|
||||
map.setView(new _ol_View_({
|
||||
center: fromLonLat([7, 0]),
|
||||
@@ -319,7 +319,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
});
|
||||
|
||||
it('is rendered the same at different latitudes for degrees', function() {
|
||||
var ctrl = new _ol_control_ScaleLine_({
|
||||
var ctrl = new ScaleLine({
|
||||
units: 'degrees'
|
||||
});
|
||||
ctrl.setMap(map);
|
||||
@@ -359,7 +359,7 @@ describe('ol.control.ScaleLine', function() {
|
||||
beforeEach(function() {
|
||||
currentZoom = 33;
|
||||
renderedHtmls = {};
|
||||
ctrl = new _ol_control_ScaleLine_({
|
||||
ctrl = new ScaleLine({
|
||||
minWidth: 10
|
||||
});
|
||||
ctrl.setMap(map);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_control_Zoom_ from '../../../../src/ol/control/Zoom.js';
|
||||
import Zoom from '../../../../src/ol/control/Zoom.js';
|
||||
|
||||
describe('ol.control.Zoom', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new _ol_control_Zoom_();
|
||||
expect(instance).to.be.an(_ol_control_Zoom_);
|
||||
var instance = new Zoom();
|
||||
expect(instance).to.be.an(Zoom);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import _ol_control_ZoomSlider_ from '../../../../src/ol/control/ZoomSlider.js';
|
||||
import ZoomSlider from '../../../../src/ol/control/ZoomSlider.js';
|
||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||
|
||||
describe('ol.control.ZoomSlider', function() {
|
||||
@@ -9,7 +9,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
beforeEach(function() {
|
||||
target = document.createElement('div');
|
||||
document.body.appendChild(target);
|
||||
zoomslider = new _ol_control_ZoomSlider_();
|
||||
zoomslider = new ZoomSlider();
|
||||
map = new _ol_Map_({
|
||||
target: target,
|
||||
controls: [zoomslider]
|
||||
@@ -59,7 +59,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
|
||||
describe('#direction_', function() {
|
||||
it('is horizontal for wide containers', function() {
|
||||
var control = new _ol_control_ZoomSlider_({});
|
||||
var control = new ZoomSlider({});
|
||||
control.element.style.width = '1000px';
|
||||
control.element.style.height = '10px';
|
||||
control.setMap(map);
|
||||
@@ -72,7 +72,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
});
|
||||
|
||||
it('is vertical for tall containers', function() {
|
||||
var control = new _ol_control_ZoomSlider_({});
|
||||
var control = new ZoomSlider({});
|
||||
control.element.style.width = '10px';
|
||||
control.element.style.height = '1000px';
|
||||
|
||||
@@ -102,7 +102,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
});
|
||||
|
||||
it('[horizontal] handles a drag sequence', function() {
|
||||
var control = new _ol_control_ZoomSlider_();
|
||||
var control = new ZoomSlider();
|
||||
map.addControl(control);
|
||||
map.getView().setZoom(0);
|
||||
control.element.style.width = '500px';
|
||||
@@ -134,7 +134,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
expect(control.dragging_).to.be(false);
|
||||
});
|
||||
it('[vertical] handles a drag sequence', function() {
|
||||
var control = new _ol_control_ZoomSlider_();
|
||||
var control = new ZoomSlider();
|
||||
control.element.style.width = '10px';
|
||||
control.element.style.height = '100px';
|
||||
control.element.firstChild.style.width = '10px';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import _ol_control_ZoomToExtent_ from '../../../../src/ol/control/ZoomToExtent.js';
|
||||
import ZoomToExtent from '../../../../src/ol/control/ZoomToExtent.js';
|
||||
|
||||
describe('ol.control.ZoomToExtent', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new _ol_control_ZoomToExtent_();
|
||||
expect(instance).to.be.an(_ol_control_ZoomToExtent_);
|
||||
var instance = new ZoomToExtent();
|
||||
expect(instance).to.be.an(ZoomToExtent);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user