This commit is contained in:
198
node_modules/ol/control/Attribution.d.ts
generated
vendored
Normal file
198
node_modules/ol/control/Attribution.d.ts
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
export default Attribution;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Specify a target if you
|
||||
* want the control to be rendered outside of the map's
|
||||
* viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Specify if attributions can
|
||||
* be collapsed. If not specified, sources control this behavior with their
|
||||
* `attributionsCollapsible` setting.
|
||||
*/
|
||||
collapsible?: boolean | undefined;
|
||||
/**
|
||||
* Specify if attributions should
|
||||
* be collapsed at startup.
|
||||
*/
|
||||
collapsed?: boolean | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
tipLabel?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the
|
||||
* collapsed attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
label?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* CSS class name for the
|
||||
* collapsed attributions button.
|
||||
*/
|
||||
expandClassName?: string | undefined;
|
||||
/**
|
||||
* Text label to use
|
||||
* for the expanded attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
collapseLabel?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* CSS class name for the
|
||||
* expanded attributions button.
|
||||
*/
|
||||
collapseClassName?: string | undefined;
|
||||
/**
|
||||
* Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-attribution'] CSS class name.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you
|
||||
* want the control to be rendered outside of the map's
|
||||
* viewport.
|
||||
* @property {boolean} [collapsible] Specify if attributions can
|
||||
* be collapsed. If not specified, sources control this behavior with their
|
||||
* `attributionsCollapsible` setting.
|
||||
* @property {boolean} [collapsed=true] Specify if attributions should
|
||||
* be collapsed at startup.
|
||||
* @property {string} [tipLabel='Attributions'] Text label to use for the button tip.
|
||||
* @property {string|HTMLElement} [label='i'] Text label to use for the
|
||||
* collapsed attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [expandClassName=className + '-expand'] CSS class name for the
|
||||
* collapsed attributions button.
|
||||
* @property {string|HTMLElement} [collapseLabel='›'] Text label to use
|
||||
* for the expanded attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [collapseClassName=className + '-collapse'] CSS class name for the
|
||||
* expanded attributions button.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Control to show all the attributions associated with the layer sources
|
||||
* in the map. This control is one of the default controls included in maps.
|
||||
* By default it will show in the bottom right portion of the map, but this can
|
||||
* be changed by using a css selector for `.ol-attribution`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Attribution extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Attribution options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private ulElement_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private collapsed_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private userCollapsed_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private overrideCollapsible_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private collapsible_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private collapseLabel_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private label_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private toggleButton_;
|
||||
/**
|
||||
* A list of currently rendered resolutions.
|
||||
* @type {Array<string>}
|
||||
* @private
|
||||
*/
|
||||
private renderedAttributions_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private renderedVisible_;
|
||||
/**
|
||||
* Collect a list of visible attributions and set the collapsible state.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {Array<string>} Attributions.
|
||||
* @private
|
||||
*/
|
||||
private collectSourceAttributions_;
|
||||
/**
|
||||
* @private
|
||||
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
private updateElement_;
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleToggle_;
|
||||
/**
|
||||
* Return `true` if the attribution is collapsible, `false` otherwise.
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
getCollapsible(): boolean;
|
||||
/**
|
||||
* Set whether the attribution should be collapsible.
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
setCollapsible(collapsible: boolean): void;
|
||||
/**
|
||||
* Collapse or expand the attribution according to the passed parameter. Will
|
||||
* not do anything if the attribution isn't collapsible or if the current
|
||||
* collapsed state is already the one requested.
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
setCollapsed(collapsed: boolean): void;
|
||||
/**
|
||||
* Return `true` when the attribution is currently collapsed or `false`
|
||||
* otherwise.
|
||||
* @return {boolean} True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
getCollapsed(): boolean;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=Attribution.d.ts.map
|
||||
1
node_modules/ol/control/Attribution.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/Attribution.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Attribution.d.ts","sourceRoot":"","sources":["../src/control/Attribution.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgCuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;AAtB7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,+CAsIC;IA7HC;;;OAGG;IACH,mBAA8C;IAE9C;;;OAGG;IACH,mBAC4D;IAE5D;;;OAGG;IACH,uBAAqC;IAErC;;;OAGG;IACH,6BAA6D;IAE7D;;;OAGG;IACH,qBACgE;IA0B9D;;;OAGG;IACH,uBAAoD;IAUpD;;;OAGG;IACH,eAA4C;IAU9C;;;OAGG;IACH,sBAAqD;IAyBrD;;;;OAIG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,yBAA4B;IAG9B;;;;;OAKG;IACH,mCA2DC;IAED;;;OAGG;IACH,uBA+BC;IAED;;;OAGG;IACH,qBAIC;IAED;;OAEG;IACH,sBASC;IAED;;;;OAIG;IACH,kBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,QAYjB;IAED;;;;;;OAMG;IACH,wBAHW,OAAO,QASjB;IAED;;;;;OAKG;IACH,gBAHY,OAAO,CAKlB;CAUF"}
|
||||
340
node_modules/ol/control/Attribution.js
generated
vendored
Normal file
340
node_modules/ol/control/Attribution.js
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/Attribution
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import { CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { equals } from '../array.js';
|
||||
import { inView } from '../layer/Layer.js';
|
||||
import { removeChildren, replaceNode } from '../dom.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-attribution'] CSS class name.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you
|
||||
* want the control to be rendered outside of the map's
|
||||
* viewport.
|
||||
* @property {boolean} [collapsible] Specify if attributions can
|
||||
* be collapsed. If not specified, sources control this behavior with their
|
||||
* `attributionsCollapsible` setting.
|
||||
* @property {boolean} [collapsed=true] Specify if attributions should
|
||||
* be collapsed at startup.
|
||||
* @property {string} [tipLabel='Attributions'] Text label to use for the button tip.
|
||||
* @property {string|HTMLElement} [label='i'] Text label to use for the
|
||||
* collapsed attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [expandClassName=className + '-expand'] CSS class name for the
|
||||
* collapsed attributions button.
|
||||
* @property {string|HTMLElement} [collapseLabel='›'] Text label to use
|
||||
* for the expanded attributions button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [collapseClassName=className + '-collapse'] CSS class name for the
|
||||
* expanded attributions button.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Control to show all the attributions associated with the layer sources
|
||||
* in the map. This control is one of the default controls included in maps.
|
||||
* By default it will show in the bottom right portion of the map, but this can
|
||||
* be changed by using a css selector for `.ol-attribution`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Attribution = /** @class */ (function (_super) {
|
||||
__extends(Attribution, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Attribution options.
|
||||
*/
|
||||
function Attribution(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
render: options.render,
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.ulElement_ = document.createElement('ul');
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.collapsed_ =
|
||||
options.collapsed !== undefined ? options.collapsed : true;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.userCollapsed_ = _this.collapsed_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.overrideCollapsible_ = options.collapsible !== undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.collapsible_ =
|
||||
options.collapsible !== undefined ? options.collapsible : true;
|
||||
if (!_this.collapsible_) {
|
||||
_this.collapsed_ = false;
|
||||
}
|
||||
var className = options.className !== undefined ? options.className : 'ol-attribution';
|
||||
var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions';
|
||||
var expandClassName = options.expandClassName !== undefined
|
||||
? options.expandClassName
|
||||
: className + '-expand';
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u203A';
|
||||
var collapseClassName = options.collapseClassName !== undefined
|
||||
? options.collapseClassName
|
||||
: className + '-collapse';
|
||||
if (typeof collapseLabel === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.collapseLabel_ = document.createElement('span');
|
||||
_this.collapseLabel_.textContent = collapseLabel;
|
||||
_this.collapseLabel_.className = collapseClassName;
|
||||
}
|
||||
else {
|
||||
_this.collapseLabel_ = collapseLabel;
|
||||
}
|
||||
var label = options.label !== undefined ? options.label : 'i';
|
||||
if (typeof label === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.label_ = document.createElement('span');
|
||||
_this.label_.textContent = label;
|
||||
_this.label_.className = expandClassName;
|
||||
}
|
||||
else {
|
||||
_this.label_ = label;
|
||||
}
|
||||
var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.toggleButton_ = document.createElement('button');
|
||||
_this.toggleButton_.setAttribute('type', 'button');
|
||||
_this.toggleButton_.setAttribute('aria-expanded', String(!_this.collapsed_));
|
||||
_this.toggleButton_.title = tipLabel;
|
||||
_this.toggleButton_.appendChild(activeLabel);
|
||||
_this.toggleButton_.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
|
||||
var cssClasses = className +
|
||||
' ' +
|
||||
CLASS_UNSELECTABLE +
|
||||
' ' +
|
||||
CLASS_CONTROL +
|
||||
(_this.collapsed_ && _this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +
|
||||
(_this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = _this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(_this.toggleButton_);
|
||||
element.appendChild(_this.ulElement_);
|
||||
/**
|
||||
* A list of currently rendered resolutions.
|
||||
* @type {Array<string>}
|
||||
* @private
|
||||
*/
|
||||
_this.renderedAttributions_ = [];
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.renderedVisible_ = true;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Collect a list of visible attributions and set the collapsible state.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @return {Array<string>} Attributions.
|
||||
* @private
|
||||
*/
|
||||
Attribution.prototype.collectSourceAttributions_ = function (frameState) {
|
||||
/**
|
||||
* Used to determine if an attribution already exists.
|
||||
* @type {!Object<string, boolean>}
|
||||
*/
|
||||
var lookup = {};
|
||||
/**
|
||||
* A list of visible attributions.
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
var visibleAttributions = [];
|
||||
var collapsible = true;
|
||||
var layerStatesArray = frameState.layerStatesArray;
|
||||
for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
|
||||
var layerState = layerStatesArray[i];
|
||||
if (!inView(layerState, frameState.viewState)) {
|
||||
continue;
|
||||
}
|
||||
var source = /** @type {import("../layer/Layer.js").default} */ (layerState.layer).getSource();
|
||||
if (!source) {
|
||||
continue;
|
||||
}
|
||||
var attributionGetter = source.getAttributions();
|
||||
if (!attributionGetter) {
|
||||
continue;
|
||||
}
|
||||
var attributions = attributionGetter(frameState);
|
||||
if (!attributions) {
|
||||
continue;
|
||||
}
|
||||
collapsible =
|
||||
collapsible && source.getAttributionsCollapsible() !== false;
|
||||
if (Array.isArray(attributions)) {
|
||||
for (var j = 0, jj = attributions.length; j < jj; ++j) {
|
||||
if (!(attributions[j] in lookup)) {
|
||||
visibleAttributions.push(attributions[j]);
|
||||
lookup[attributions[j]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(attributions in lookup)) {
|
||||
visibleAttributions.push(attributions);
|
||||
lookup[attributions] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.overrideCollapsible_) {
|
||||
this.setCollapsible(collapsible);
|
||||
}
|
||||
return visibleAttributions;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
*/
|
||||
Attribution.prototype.updateElement_ = function (frameState) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
this.element.style.display = 'none';
|
||||
this.renderedVisible_ = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var attributions = this.collectSourceAttributions_(frameState);
|
||||
var visible = attributions.length > 0;
|
||||
if (this.renderedVisible_ != visible) {
|
||||
this.element.style.display = visible ? '' : 'none';
|
||||
this.renderedVisible_ = visible;
|
||||
}
|
||||
if (equals(attributions, this.renderedAttributions_)) {
|
||||
return;
|
||||
}
|
||||
removeChildren(this.ulElement_);
|
||||
// append the attributions
|
||||
for (var i = 0, ii = attributions.length; i < ii; ++i) {
|
||||
var element = document.createElement('li');
|
||||
element.innerHTML = attributions[i];
|
||||
this.ulElement_.appendChild(element);
|
||||
}
|
||||
this.renderedAttributions_ = attributions;
|
||||
};
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
Attribution.prototype.handleClick_ = function (event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
this.userCollapsed_ = this.collapsed_;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Attribution.prototype.handleToggle_ = function () {
|
||||
this.element.classList.toggle(CLASS_COLLAPSED);
|
||||
if (this.collapsed_) {
|
||||
replaceNode(this.collapseLabel_, this.label_);
|
||||
}
|
||||
else {
|
||||
replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));
|
||||
};
|
||||
/**
|
||||
* Return `true` if the attribution is collapsible, `false` otherwise.
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
Attribution.prototype.getCollapsible = function () {
|
||||
return this.collapsible_;
|
||||
};
|
||||
/**
|
||||
* Set whether the attribution should be collapsible.
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
Attribution.prototype.setCollapsible = function (collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
this.collapsible_ = collapsible;
|
||||
this.element.classList.toggle('ol-uncollapsible');
|
||||
if (this.userCollapsed_) {
|
||||
this.handleToggle_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Collapse or expand the attribution according to the passed parameter. Will
|
||||
* not do anything if the attribution isn't collapsible or if the current
|
||||
* collapsed state is already the one requested.
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
Attribution.prototype.setCollapsed = function (collapsed) {
|
||||
this.userCollapsed_ = collapsed;
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
this.handleToggle_();
|
||||
};
|
||||
/**
|
||||
* Return `true` when the attribution is currently collapsed or `false`
|
||||
* otherwise.
|
||||
* @return {boolean} True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
Attribution.prototype.getCollapsed = function () {
|
||||
return this.collapsed_;
|
||||
};
|
||||
/**
|
||||
* Update the attribution element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
Attribution.prototype.render = function (mapEvent) {
|
||||
this.updateElement_(mapEvent.frameState);
|
||||
};
|
||||
return Attribution;
|
||||
}(Control));
|
||||
export default Attribution;
|
||||
//# sourceMappingURL=Attribution.js.map
|
||||
1
node_modules/ol/control/Attribution.js.map
generated
vendored
Normal file
1
node_modules/ol/control/Attribution.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
114
node_modules/ol/control/Control.d.ts
generated
vendored
Normal file
114
node_modules/ol/control/Control.d.ts
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
export default Control;
|
||||
export type Options = {
|
||||
/**
|
||||
* The element is the control's
|
||||
* container element. This only needs to be specified if you're developing
|
||||
* a custom control.
|
||||
*/
|
||||
element?: HTMLElement | undefined;
|
||||
/**
|
||||
* Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
/**
|
||||
* Specify a target if you want
|
||||
* the control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {HTMLElement} [element] The element is the control's
|
||||
* container element. This only needs to be specified if you're developing
|
||||
* a custom control.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want
|
||||
* the control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control is a visible widget with a DOM element in a fixed position on the
|
||||
* screen. They can involve user input (buttons), or be informational only;
|
||||
* the position is determined using CSS. By default these are placed in the
|
||||
* container with CSS class name `ol-overlaycontainer-stopevent`, but can use
|
||||
* any outside DOM element.
|
||||
*
|
||||
* This is the base class for controls. You can use it for simple custom
|
||||
* controls by creating the element with listeners, creating an instance:
|
||||
* ```js
|
||||
* var myControl = new Control({element: myElement});
|
||||
* ```
|
||||
* and then adding this to the map.
|
||||
*
|
||||
* The main advantage of having this as a control rather than a simple separate
|
||||
* DOM element is that preventing propagation is handled for you. Controls
|
||||
* will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.
|
||||
*
|
||||
* You can also extend this base for your own control class. See
|
||||
* examples/custom-controls for an example of how to do this.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Control extends BaseObject {
|
||||
/**
|
||||
* @param {Options} options Control options.
|
||||
*/
|
||||
constructor(options: Options);
|
||||
/**
|
||||
* @protected
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
protected element: HTMLElement;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private target_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../PluggableMap.js").default|null}
|
||||
*/
|
||||
private map_;
|
||||
/**
|
||||
* @protected
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
protected listenerKeys: Array<import("../events.js").EventsKey>;
|
||||
/**
|
||||
* Renders the control.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @api
|
||||
*/
|
||||
render(mapEvent: import("../MapEvent.js").default): void;
|
||||
/**
|
||||
* Get the map associated with this control.
|
||||
* @return {import("../PluggableMap.js").default|null} Map.
|
||||
* @api
|
||||
*/
|
||||
getMap(): import("../PluggableMap.js").default | null;
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default | null): void;
|
||||
/**
|
||||
* This function is used to set a target element for the control. It has no
|
||||
* effect if it is called after the control has been added to the map (i.e.
|
||||
* after `setMap` is called on the control). If no `target` is set in the
|
||||
* options passed to the control constructor and if `setTarget` is not called
|
||||
* then the control is added to the map's overlay container.
|
||||
* @param {HTMLElement|string} target Target.
|
||||
* @api
|
||||
*/
|
||||
setTarget(target: HTMLElement | string): void;
|
||||
}
|
||||
import BaseObject from "../Object.js";
|
||||
//# sourceMappingURL=Control.d.ts.map
|
||||
1
node_modules/ol/control/Control.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/Control.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Control.d.ts","sourceRoot":"","sources":["../src/control/Control.js"],"names":[],"mappings":";;;;;;;;;;;;;qBAcuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;;;;;;AAL7D;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAyCjB;IA/BC;;;OAGG;IACH,mBAFU,WAAW,CAEkB;IAEvC;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,aAAgB;IAEhB;;;OAGG;IACH,wBAFW,MAAM,OAAO,cAAc,EAAE,SAAS,CAAC,CAE5B;IA2DxB;;;;OAIG;IACH,iBAHW,OAAO,gBAAgB,EAAE,OAAO,QAGxB;IA7CnB;;;;OAIG;IACH,UAHY,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,CAKpD;IAED;;;;;;;OAOG;IACH,YAHW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,QAwBnD;IASD;;;;;;;;OAQG;IACH,kBAHW,WAAW,GAAC,MAAM,QAM5B;CACF"}
|
||||
163
node_modules/ol/control/Control.js
generated
vendored
Normal file
163
node_modules/ol/control/Control.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/Control
|
||||
*/
|
||||
import BaseObject from '../Object.js';
|
||||
import MapEventType from '../MapEventType.js';
|
||||
import { VOID } from '../functions.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
import { removeNode } from '../dom.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {HTMLElement} [element] The element is the control's
|
||||
* container element. This only needs to be specified if you're developing
|
||||
* a custom control.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
||||
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want
|
||||
* the control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control is a visible widget with a DOM element in a fixed position on the
|
||||
* screen. They can involve user input (buttons), or be informational only;
|
||||
* the position is determined using CSS. By default these are placed in the
|
||||
* container with CSS class name `ol-overlaycontainer-stopevent`, but can use
|
||||
* any outside DOM element.
|
||||
*
|
||||
* This is the base class for controls. You can use it for simple custom
|
||||
* controls by creating the element with listeners, creating an instance:
|
||||
* ```js
|
||||
* var myControl = new Control({element: myElement});
|
||||
* ```
|
||||
* and then adding this to the map.
|
||||
*
|
||||
* The main advantage of having this as a control rather than a simple separate
|
||||
* DOM element is that preventing propagation is handled for you. Controls
|
||||
* will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.
|
||||
*
|
||||
* You can also extend this base for your own control class. See
|
||||
* examples/custom-controls for an example of how to do this.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Control = /** @class */ (function (_super) {
|
||||
__extends(Control, _super);
|
||||
/**
|
||||
* @param {Options} options Control options.
|
||||
*/
|
||||
function Control(options) {
|
||||
var _this = _super.call(this) || this;
|
||||
var element = options.element;
|
||||
if (element && !options.target && !element.style.pointerEvents) {
|
||||
element.style.pointerEvents = 'auto';
|
||||
}
|
||||
/**
|
||||
* @protected
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.element = element ? element : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.target_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../PluggableMap.js").default|null}
|
||||
*/
|
||||
_this.map_ = null;
|
||||
/**
|
||||
* @protected
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
_this.listenerKeys = [];
|
||||
if (options.render) {
|
||||
_this.render = options.render;
|
||||
}
|
||||
if (options.target) {
|
||||
_this.setTarget(options.target);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Clean up.
|
||||
*/
|
||||
Control.prototype.disposeInternal = function () {
|
||||
removeNode(this.element);
|
||||
_super.prototype.disposeInternal.call(this);
|
||||
};
|
||||
/**
|
||||
* Get the map associated with this control.
|
||||
* @return {import("../PluggableMap.js").default|null} Map.
|
||||
* @api
|
||||
*/
|
||||
Control.prototype.getMap = function () {
|
||||
return this.map_;
|
||||
};
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
Control.prototype.setMap = function (map) {
|
||||
if (this.map_) {
|
||||
removeNode(this.element);
|
||||
}
|
||||
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
|
||||
unlistenByKey(this.listenerKeys[i]);
|
||||
}
|
||||
this.listenerKeys.length = 0;
|
||||
this.map_ = map;
|
||||
if (map) {
|
||||
var target = this.target_
|
||||
? this.target_
|
||||
: map.getOverlayContainerStopEvent();
|
||||
target.appendChild(this.element);
|
||||
if (this.render !== VOID) {
|
||||
this.listenerKeys.push(listen(map, MapEventType.POSTRENDER, this.render, this));
|
||||
}
|
||||
map.render();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Renders the control.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @api
|
||||
*/
|
||||
Control.prototype.render = function (mapEvent) { };
|
||||
/**
|
||||
* This function is used to set a target element for the control. It has no
|
||||
* effect if it is called after the control has been added to the map (i.e.
|
||||
* after `setMap` is called on the control). If no `target` is set in the
|
||||
* options passed to the control constructor and if `setTarget` is not called
|
||||
* then the control is added to the map's overlay container.
|
||||
* @param {HTMLElement|string} target Target.
|
||||
* @api
|
||||
*/
|
||||
Control.prototype.setTarget = function (target) {
|
||||
this.target_ =
|
||||
typeof target === 'string' ? document.getElementById(target) : target;
|
||||
};
|
||||
return Control;
|
||||
}(BaseObject));
|
||||
export default Control;
|
||||
//# sourceMappingURL=Control.js.map
|
||||
1
node_modules/ol/control/Control.js.map
generated
vendored
Normal file
1
node_modules/ol/control/Control.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Control.js","sourceRoot":"","sources":["../src/control/Control.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAAsB,2BAAU;IAC9B;;OAEG;IACH,iBAAY,OAAO;QAAnB,YACE,iBAAO,SAsCR;QApCC,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE;YAC9D,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;SACtC;QAED;;;WAGG;QACH,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAExC;;;WAGG;QACH,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB;;;WAGG;QACH,KAAI,CAAC,IA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,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CACxD,CAAC;aACH;YACD,GAAG,CAAC,MAAM,EAAE,CAAC;SACd;IACH,CAAC;IAED;;;;OAIG;IACH,wBAAM,GAAN,UAAO,QAAQ,IAAG,CAAC;IAEnB;;;;;;;;OAQG;IACH,2BAAS,GAAT,UAAU,MAAM;QACd,IAAI,CAAC,OAAO;YACV,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1E,CAAC;IACH,cAAC;AAAD,CAAC,AAjHD,CAAsB,UAAU,GAiH/B;AAED,eAAe,OAAO,CAAC"}
|
||||
191
node_modules/ol/control/FullScreen.d.ts
generated
vendored
Normal file
191
node_modules/ol/control/FullScreen.d.ts
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
export default FullScreen;
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type FullScreenOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes | 'enterfullscreen' | 'leavefullscreen', import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types, import("../Object").ObjectEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | 'enterfullscreen' | 'leavefullscreen' | import("../ObjectEventType").Types, Return>;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
label?: string | HTMLElement | Text | undefined;
|
||||
/**
|
||||
* Text label to use for the
|
||||
* button when full-screen is active.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
labelActive?: string | HTMLElement | Text | undefined;
|
||||
/**
|
||||
* CSS class name for the button
|
||||
* when full-screen is active.
|
||||
*/
|
||||
activeClassName?: string | undefined;
|
||||
/**
|
||||
* CSS class name for the button
|
||||
* when full-screen is inactive.
|
||||
*/
|
||||
inactiveClassName?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
tipLabel?: string | undefined;
|
||||
/**
|
||||
* Full keyboard access.
|
||||
*/
|
||||
keys?: boolean | undefined;
|
||||
/**
|
||||
* Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* The element to be displayed
|
||||
* fullscreen. When not provided, the element containing the map viewport will
|
||||
* be displayed fullscreen.
|
||||
*/
|
||||
source?: string | HTMLElement | undefined;
|
||||
};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes|
|
||||
* 'enterfullscreen'|'leavefullscreen', import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types, import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|
|
||||
* 'enterfullscreen'|'leavefullscreen'|import("../ObjectEventType").Types, Return>} FullScreenOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-full-screen'] CSS class name.
|
||||
* @property {string|Text|HTMLElement} [label='\u2922'] Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string|Text|HTMLElement} [labelActive='\u00d7'] Text label to use for the
|
||||
* button when full-screen is active.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [activeClassName=className + '-true'] CSS class name for the button
|
||||
* when full-screen is active.
|
||||
* @property {string} [inactiveClassName=className + '-false'] CSS class name for the button
|
||||
* when full-screen is inactive.
|
||||
* @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.
|
||||
* @property {boolean} [keys=false] Full keyboard access.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
* @property {HTMLElement|string} [source] The element to be displayed
|
||||
* fullscreen. When not provided, the element containing the map viewport will
|
||||
* be displayed fullscreen.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Provides a button that when clicked fills up the full screen with the map.
|
||||
* The full screen source element is by default the element containing the map viewport unless
|
||||
* overridden by providing the `source` option. In which case, the dom
|
||||
* element introduced using this parameter will be displayed in full screen.
|
||||
*
|
||||
* When in full screen mode, a close button is shown to exit full screen mode.
|
||||
* The [Fullscreen API](https://www.w3.org/TR/fullscreen/) is used to
|
||||
* toggle the map in full screen mode.
|
||||
*
|
||||
* @fires FullScreenEventType#enterfullscreen
|
||||
* @fires FullScreenEventType#leavefullscreen
|
||||
* @api
|
||||
*/
|
||||
declare class FullScreen extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {FullScreenOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: FullScreenOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {FullScreenOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: FullScreenOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {FullScreenOnSignature<void>}
|
||||
*/
|
||||
un: FullScreenOnSignature<void>;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private keys_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement|string|undefined}
|
||||
*/
|
||||
private source_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private isInFullscreen_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private boundHandleMapTargetChange_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
private cssClassName_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
private documentListeners_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
private activeClassName_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
private inactiveClassName_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Text|HTMLElement}
|
||||
*/
|
||||
private labelNode_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Text|HTMLElement}
|
||||
*/
|
||||
private labelActiveNode_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private button_;
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleFullScreen_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleFullScreenChange_;
|
||||
/**
|
||||
* @param {HTMLElement} element Target element
|
||||
* @param {boolean} fullscreen True if fullscreen class name should be active
|
||||
* @private
|
||||
*/
|
||||
private setClassName_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleMapTargetChange_;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=FullScreen.d.ts.map
|
||||
1
node_modules/ol/control/FullScreen.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/FullScreen.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FullScreen.d.ts","sourceRoot":"","sources":["../src/control/FullScreen.js"],"names":[],"mappings":";;;;4CAqCa,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,GAClF,iBAAuB,GAAC,iBAAiB,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACxF,OAAW,eAAe,EAAE,WAAW,CAAC,OAAO,oBAAoB,EAAE,KAAK,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GACpH,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GAClF,iBAAuB,GAAC,iBAAiB,GAAC,OAAO,oBAAoB,EAAE,KAAK,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AANtF;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;GAcG;AACH;IACE;;OAEG;IACH,+CAqHC;IA7GC;;OAEG;IACH,IAFU,sBAAsB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEvD;IAEP;;OAEG;IACH,MAFU,sBAAsB,OAAO,WAAW,EAAE,SAAS,CAAC,CAErD;IAET;;OAEG;IACH,IAFU,sBAAsB,IAAI,CAAC,CAE9B;IAEP;;;OAGG;IACH,cAA8D;IAE9D;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,wBAA4B;IAE5B;;OAEG;IACH,oCAAyE;IAEzE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,2BAA4B;IAE5B;;;OAGG;IACH,yBAGoC;IAEpC;;;OAGG;IACH,2BAGqC;IAIrC;;;OAGG;IACH,mBACoE;IAKpE;;;OAGG;IACH,yBAGiB;IAIjB;;;OAGG;IACH,gBAA+C;IAejD;;;OAGG;IACH,qBAGC;IAED;;OAEG;IACH,0BA2BC;IAED;;OAEG;IACH,gCAkBC;IAED;;;;OAIG;IACH,sBAQC;IA8BD;;OAEG;IACH,+BAuBC;CACF"}
|
||||
379
node_modules/ol/control/FullScreen.js
generated
vendored
Normal file
379
node_modules/ol/control/FullScreen.js
generated
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/FullScreen
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import MapProperty from '../MapProperty.js';
|
||||
import { CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED } from '../css.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
import { replaceNode } from '../dom.js';
|
||||
var events = [
|
||||
'fullscreenchange',
|
||||
'webkitfullscreenchange',
|
||||
'MSFullscreenChange',
|
||||
];
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var FullScreenEventType = {
|
||||
/**
|
||||
* Triggered after the map entered fullscreen.
|
||||
* @event FullScreenEventType#enterfullscreen
|
||||
* @api
|
||||
*/
|
||||
ENTERFULLSCREEN: 'enterfullscreen',
|
||||
/**
|
||||
* Triggered after the map leave fullscreen.
|
||||
* @event FullScreenEventType#leavefullscreen
|
||||
* @api
|
||||
*/
|
||||
LEAVEFULLSCREEN: 'leavefullscreen',
|
||||
};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes|
|
||||
* 'enterfullscreen'|'leavefullscreen', import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types, import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|
|
||||
* 'enterfullscreen'|'leavefullscreen'|import("../ObjectEventType").Types, Return>} FullScreenOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-full-screen'] CSS class name.
|
||||
* @property {string|Text|HTMLElement} [label='\u2922'] Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string|Text|HTMLElement} [labelActive='\u00d7'] Text label to use for the
|
||||
* button when full-screen is active.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [activeClassName=className + '-true'] CSS class name for the button
|
||||
* when full-screen is active.
|
||||
* @property {string} [inactiveClassName=className + '-false'] CSS class name for the button
|
||||
* when full-screen is inactive.
|
||||
* @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.
|
||||
* @property {boolean} [keys=false] Full keyboard access.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
* @property {HTMLElement|string} [source] The element to be displayed
|
||||
* fullscreen. When not provided, the element containing the map viewport will
|
||||
* be displayed fullscreen.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Provides a button that when clicked fills up the full screen with the map.
|
||||
* The full screen source element is by default the element containing the map viewport unless
|
||||
* overridden by providing the `source` option. In which case, the dom
|
||||
* element introduced using this parameter will be displayed in full screen.
|
||||
*
|
||||
* When in full screen mode, a close button is shown to exit full screen mode.
|
||||
* The [Fullscreen API](https://www.w3.org/TR/fullscreen/) is used to
|
||||
* toggle the map in full screen mode.
|
||||
*
|
||||
* @fires FullScreenEventType#enterfullscreen
|
||||
* @fires FullScreenEventType#leavefullscreen
|
||||
* @api
|
||||
*/
|
||||
var FullScreen = /** @class */ (function (_super) {
|
||||
__extends(FullScreen, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function FullScreen(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/***
|
||||
* @type {FullScreenOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {FullScreenOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {FullScreenOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.keys_ = options.keys !== undefined ? options.keys : false;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement|string|undefined}
|
||||
*/
|
||||
_this.source_ = options.source;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.isInFullscreen_ = false;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_this.boundHandleMapTargetChange_ = _this.handleMapTargetChange_.bind(_this);
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
_this.cssClassName_ =
|
||||
options.className !== undefined ? options.className : 'ol-full-screen';
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
_this.documentListeners_ = [];
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
_this.activeClassName_ =
|
||||
options.activeClassName !== undefined
|
||||
? options.activeClassName.split(' ')
|
||||
: [_this.cssClassName_ + '-true'];
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
_this.inactiveClassName_ =
|
||||
options.inactiveClassName !== undefined
|
||||
? options.inactiveClassName.split(' ')
|
||||
: [_this.cssClassName_ + '-false'];
|
||||
var label = options.label !== undefined ? options.label : '\u2922';
|
||||
/**
|
||||
* @private
|
||||
* @type {Text|HTMLElement}
|
||||
*/
|
||||
_this.labelNode_ =
|
||||
typeof label === 'string' ? document.createTextNode(label) : label;
|
||||
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
|
||||
/**
|
||||
* @private
|
||||
* @type {Text|HTMLElement}
|
||||
*/
|
||||
_this.labelActiveNode_ =
|
||||
typeof labelActive === 'string'
|
||||
? document.createTextNode(labelActive)
|
||||
: labelActive;
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.button_ = document.createElement('button');
|
||||
_this.button_.title = tipLabel;
|
||||
_this.button_.setAttribute('type', 'button');
|
||||
_this.button_.appendChild(_this.labelNode_);
|
||||
_this.button_.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
|
||||
_this.setClassName_(_this.button_, _this.isInFullscreen_);
|
||||
_this.element.className = "".concat(_this.cssClassName_, " ").concat(CLASS_UNSELECTABLE, " ").concat(CLASS_CONTROL);
|
||||
_this.element.appendChild(_this.button_);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
FullScreen.prototype.handleClick_ = function (event) {
|
||||
event.preventDefault();
|
||||
this.handleFullScreen_();
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
FullScreen.prototype.handleFullScreen_ = function () {
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
var doc = map.getOwnerDocument();
|
||||
if (!isFullScreenSupported(doc)) {
|
||||
return;
|
||||
}
|
||||
if (isFullScreen(doc)) {
|
||||
exitFullScreen(doc);
|
||||
}
|
||||
else {
|
||||
var element = void 0;
|
||||
if (this.source_) {
|
||||
element =
|
||||
typeof this.source_ === 'string'
|
||||
? doc.getElementById(this.source_)
|
||||
: this.source_;
|
||||
}
|
||||
else {
|
||||
element = map.getTargetElement();
|
||||
}
|
||||
if (this.keys_) {
|
||||
requestFullScreenWithKeys(element);
|
||||
}
|
||||
else {
|
||||
requestFullScreen(element);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
FullScreen.prototype.handleFullScreenChange_ = function () {
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
var wasInFullscreen = this.isInFullscreen_;
|
||||
this.isInFullscreen_ = isFullScreen(map.getOwnerDocument());
|
||||
if (wasInFullscreen !== this.isInFullscreen_) {
|
||||
this.setClassName_(this.button_, this.isInFullscreen_);
|
||||
if (this.isInFullscreen_) {
|
||||
replaceNode(this.labelActiveNode_, this.labelNode_);
|
||||
this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);
|
||||
}
|
||||
else {
|
||||
replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);
|
||||
}
|
||||
map.updateSize();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {HTMLElement} element Target element
|
||||
* @param {boolean} fullscreen True if fullscreen class name should be active
|
||||
* @private
|
||||
*/
|
||||
FullScreen.prototype.setClassName_ = function (element, fullscreen) {
|
||||
var _a, _b, _c, _d;
|
||||
if (fullscreen) {
|
||||
(_a = element.classList).remove.apply(_a, this.inactiveClassName_);
|
||||
(_b = element.classList).add.apply(_b, this.activeClassName_);
|
||||
}
|
||||
else {
|
||||
(_c = element.classList).remove.apply(_c, this.activeClassName_);
|
||||
(_d = element.classList).add.apply(_d, this.inactiveClassName_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
FullScreen.prototype.setMap = function (map) {
|
||||
var oldMap = this.getMap();
|
||||
if (oldMap) {
|
||||
oldMap.removeChangeListener(MapProperty.TARGET, this.boundHandleMapTargetChange_);
|
||||
}
|
||||
_super.prototype.setMap.call(this, map);
|
||||
this.handleMapTargetChange_();
|
||||
if (map) {
|
||||
map.addChangeListener(MapProperty.TARGET, this.boundHandleMapTargetChange_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
FullScreen.prototype.handleMapTargetChange_ = function () {
|
||||
var listeners = this.documentListeners_;
|
||||
for (var i = 0, ii = listeners.length; i < ii; ++i) {
|
||||
unlistenByKey(listeners[i]);
|
||||
}
|
||||
listeners.length = 0;
|
||||
var map = this.getMap();
|
||||
if (map) {
|
||||
var doc = map.getOwnerDocument();
|
||||
if (isFullScreenSupported(doc)) {
|
||||
this.element.classList.remove(CLASS_UNSUPPORTED);
|
||||
}
|
||||
else {
|
||||
this.element.classList.add(CLASS_UNSUPPORTED);
|
||||
}
|
||||
for (var i = 0, ii = events.length; i < ii; ++i) {
|
||||
listeners.push(listen(doc, events[i], this.handleFullScreenChange_, this));
|
||||
}
|
||||
this.handleFullScreenChange_();
|
||||
}
|
||||
};
|
||||
return FullScreen;
|
||||
}(Control));
|
||||
/**
|
||||
* @param {Document} doc The root document to check.
|
||||
* @return {boolean} Fullscreen is supported by the current platform.
|
||||
*/
|
||||
function isFullScreenSupported(doc) {
|
||||
var body = doc.body;
|
||||
return !!(body['webkitRequestFullscreen'] ||
|
||||
(body['msRequestFullscreen'] && doc['msFullscreenEnabled']) ||
|
||||
(body.requestFullscreen && doc.fullscreenEnabled));
|
||||
}
|
||||
/**
|
||||
* @param {Document} doc The root document to check.
|
||||
* @return {boolean} Element is currently in fullscreen.
|
||||
*/
|
||||
function isFullScreen(doc) {
|
||||
return !!(doc['webkitIsFullScreen'] ||
|
||||
doc['msFullscreenElement'] ||
|
||||
doc.fullscreenElement);
|
||||
}
|
||||
/**
|
||||
* Request to fullscreen an element.
|
||||
* @param {HTMLElement} element Element to request fullscreen
|
||||
*/
|
||||
function requestFullScreen(element) {
|
||||
if (element.requestFullscreen) {
|
||||
element.requestFullscreen();
|
||||
}
|
||||
else if (element['msRequestFullscreen']) {
|
||||
element['msRequestFullscreen']();
|
||||
}
|
||||
else if (element['webkitRequestFullscreen']) {
|
||||
element['webkitRequestFullscreen']();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Request to fullscreen an element with keyboard input.
|
||||
* @param {HTMLElement} element Element to request fullscreen
|
||||
*/
|
||||
function requestFullScreenWithKeys(element) {
|
||||
if (element['webkitRequestFullscreen']) {
|
||||
element['webkitRequestFullscreen']();
|
||||
}
|
||||
else {
|
||||
requestFullScreen(element);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Exit fullscreen.
|
||||
* @param {Document} doc The document to exit fullscren from
|
||||
*/
|
||||
function exitFullScreen(doc) {
|
||||
if (doc.exitFullscreen) {
|
||||
doc.exitFullscreen();
|
||||
}
|
||||
else if (doc['msExitFullscreen']) {
|
||||
doc['msExitFullscreen']();
|
||||
}
|
||||
else if (doc['webkitExitFullscreen']) {
|
||||
doc['webkitExitFullscreen']();
|
||||
}
|
||||
}
|
||||
export default FullScreen;
|
||||
//# sourceMappingURL=FullScreen.js.map
|
||||
1
node_modules/ol/control/FullScreen.js.map
generated
vendored
Normal file
1
node_modules/ol/control/FullScreen.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
178
node_modules/ol/control/MousePosition.d.ts
generated
vendored
Normal file
178
node_modules/ol/control/MousePosition.d.ts
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
export default MousePosition;
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type MousePositionOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:coordinateFormat' | 'change:projection', import("../Object").ObjectEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:coordinateFormat' | 'change:projection', Return>;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Coordinate format.
|
||||
*/
|
||||
coordinateFormat?: import("../coordinate.js").CoordinateFormat | undefined;
|
||||
/**
|
||||
* Projection. Default is the view projection.
|
||||
*/
|
||||
projection?: import("../proj.js").ProjectionLike;
|
||||
/**
|
||||
* Function called when the
|
||||
* control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
/**
|
||||
* Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Markup to show when the mouse position is not
|
||||
* available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space
|
||||
* is rendered when the mouse leaves the viewport. To render something else, provide a string
|
||||
* to be used as the text content (e.g. 'no position' or '' for an empty string). Set the placeholder
|
||||
* to `false` to retain the last position when the mouse leaves the viewport. In a future release, this
|
||||
* will be the default behavior.
|
||||
*/
|
||||
placeholder?: string | boolean | undefined;
|
||||
/**
|
||||
* This option is deprecated. Use the `placeholder` option instead.
|
||||
*/
|
||||
undefinedHTML?: string | undefined;
|
||||
};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:coordinateFormat'|'change:projection', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:coordinateFormat'|'change:projection', Return>} MousePositionOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-mouse-position'] CSS class name.
|
||||
* @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the
|
||||
* control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
* @property {string|boolean} [placeholder] Markup to show when the mouse position is not
|
||||
* available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space
|
||||
* is rendered when the mouse leaves the viewport. To render something else, provide a string
|
||||
* to be used as the text content (e.g. 'no position' or '' for an empty string). Set the placeholder
|
||||
* to `false` to retain the last position when the mouse leaves the viewport. In a future release, this
|
||||
* will be the default behavior.
|
||||
* @property {string} [undefinedHTML=' '] This option is deprecated. Use the `placeholder` option instead.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control to show the 2D coordinates of the mouse cursor. By default, these
|
||||
* are in the view projection, but can be in any supported projection.
|
||||
* By default the control is shown in the top right corner of the map, but this
|
||||
* can be changed by using the css selector `.ol-mouse-position`.
|
||||
*
|
||||
* On touch devices, which usually do not have a mouse cursor, the coordinates
|
||||
* of the currently touched position are shown.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class MousePosition extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Mouse position options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {MousePositionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: MousePositionOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {MousePositionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: MousePositionOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {MousePositionOnSignature<void>}
|
||||
*/
|
||||
un: MousePositionOnSignature<void>;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
private placeholder_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private renderOnMouseOut_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
private renderedHTML_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../proj/Projection.js").default}
|
||||
*/
|
||||
private mapProjection_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../proj.js").TransformFunction}
|
||||
*/
|
||||
private transform_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleProjectionChanged_;
|
||||
/**
|
||||
* Return the coordinate format type used to render the current position or
|
||||
* undefined.
|
||||
* @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
getCoordinateFormat(): import("../coordinate.js").CoordinateFormat | undefined;
|
||||
/**
|
||||
* Return the projection that is used to report the mouse position.
|
||||
* @return {import("../proj/Projection.js").default|undefined} The projection to report mouse
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
getProjection(): import("../proj/Projection.js").default | undefined;
|
||||
/**
|
||||
* @param {MouseEvent} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
protected handleMouseMove(event: MouseEvent): void;
|
||||
/**
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
protected handleMouseOut(event: Event): void;
|
||||
/**
|
||||
* Set the coordinate format type used to render the current position.
|
||||
* @param {import("../coordinate.js").CoordinateFormat} format The format to render the current
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setCoordinateFormat(format: import("../coordinate.js").CoordinateFormat): void;
|
||||
/**
|
||||
* Set the projection that is used to report the mouse position.
|
||||
* @param {import("../proj.js").ProjectionLike} projection The projection to report mouse
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setProjection(projection: import("../proj.js").ProjectionLike): void;
|
||||
/**
|
||||
* @param {?import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @private
|
||||
*/
|
||||
private updateHTML_;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=MousePosition.d.ts.map
|
||||
1
node_modules/ol/control/MousePosition.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/MousePosition.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MousePosition.d.ts","sourceRoot":"","sources":["../src/control/MousePosition.js"],"names":[],"m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;;;OAMG;IACH,4BALW,OAAO,kBAAkB,EAAE,gBAAgB,QAOrD;IAED;;;;;;OAMG;IACH,0BALW,OAAO,YAAY,EAAE,cAAc,QAO7C;IAED;;;OAGG;IACH,oBAqCC;CAmBF"}
|
||||
295
node_modules/ol/control/MousePosition.js
generated
vendored
Normal file
295
node_modules/ol/control/MousePosition.js
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* @module ol/control/MousePosition
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import Control from './Control.js';
|
||||
import EventType from '../pointer/EventType.js';
|
||||
import { get as getProjection, getTransformFromProjections, getUserProjection, identityTransform, } from '../proj.js';
|
||||
import { listen } from '../events.js';
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
var PROJECTION = 'projection';
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
var COORDINATE_FORMAT = 'coordinateFormat';
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:coordinateFormat'|'change:projection', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:coordinateFormat'|'change:projection', Return>} MousePositionOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-mouse-position'] CSS class name.
|
||||
* @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the
|
||||
* control should be re-rendered. This is called in a `requestAnimationFrame`
|
||||
* callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
* @property {string|boolean} [placeholder] Markup to show when the mouse position is not
|
||||
* available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space
|
||||
* is rendered when the mouse leaves the viewport. To render something else, provide a string
|
||||
* to be used as the text content (e.g. 'no position' or '' for an empty string). Set the placeholder
|
||||
* to `false` to retain the last position when the mouse leaves the viewport. In a future release, this
|
||||
* will be the default behavior.
|
||||
* @property {string} [undefinedHTML=' '] This option is deprecated. Use the `placeholder` option instead.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control to show the 2D coordinates of the mouse cursor. By default, these
|
||||
* are in the view projection, but can be in any supported projection.
|
||||
* By default the control is shown in the top right corner of the map, but this
|
||||
* can be changed by using the css selector `.ol-mouse-position`.
|
||||
*
|
||||
* On touch devices, which usually do not have a mouse cursor, the coordinates
|
||||
* of the currently touched position are shown.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var MousePosition = /** @class */ (function (_super) {
|
||||
__extends(MousePosition, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Mouse position options.
|
||||
*/
|
||||
function MousePosition(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var element = document.createElement('div');
|
||||
element.className =
|
||||
options.className !== undefined ? options.className : 'ol-mouse-position';
|
||||
_this = _super.call(this, {
|
||||
element: element,
|
||||
render: options.render,
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/***
|
||||
* @type {MousePositionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {MousePositionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {MousePositionOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
_this.addChangeListener(PROJECTION, _this.handleProjectionChanged_);
|
||||
if (options.coordinateFormat) {
|
||||
_this.setCoordinateFormat(options.coordinateFormat);
|
||||
}
|
||||
if (options.projection) {
|
||||
_this.setProjection(options.projection);
|
||||
}
|
||||
/**
|
||||
* Change this to `false` when removing the deprecated `undefinedHTML` option.
|
||||
* @type {boolean}
|
||||
*/
|
||||
var renderOnMouseOut = true;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
var placeholder = ' ';
|
||||
if ('undefinedHTML' in options) {
|
||||
// deprecated behavior
|
||||
if (options.undefinedHTML !== undefined) {
|
||||
placeholder = options.undefinedHTML;
|
||||
}
|
||||
renderOnMouseOut = !!placeholder;
|
||||
}
|
||||
else if ('placeholder' in options) {
|
||||
if (options.placeholder === false) {
|
||||
renderOnMouseOut = false;
|
||||
}
|
||||
else {
|
||||
placeholder = String(options.placeholder);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
_this.placeholder_ = placeholder;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.renderOnMouseOut_ = renderOnMouseOut;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
_this.renderedHTML_ = element.innerHTML;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../proj/Projection.js").default}
|
||||
*/
|
||||
_this.mapProjection_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../proj.js").TransformFunction}
|
||||
*/
|
||||
_this.transform_ = null;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
MousePosition.prototype.handleProjectionChanged_ = function () {
|
||||
this.transform_ = null;
|
||||
};
|
||||
/**
|
||||
* Return the coordinate format type used to render the current position or
|
||||
* undefined.
|
||||
* @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.getCoordinateFormat = function () {
|
||||
return /** @type {import("../coordinate.js").CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT));
|
||||
};
|
||||
/**
|
||||
* Return the projection that is used to report the mouse position.
|
||||
* @return {import("../proj/Projection.js").default|undefined} The projection to report mouse
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.getProjection = function () {
|
||||
return /** @type {import("../proj/Projection.js").default|undefined} */ (this.get(PROJECTION));
|
||||
};
|
||||
/**
|
||||
* @param {MouseEvent} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
MousePosition.prototype.handleMouseMove = function (event) {
|
||||
var map = this.getMap();
|
||||
this.updateHTML_(map.getEventPixel(event));
|
||||
};
|
||||
/**
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
MousePosition.prototype.handleMouseOut = function (event) {
|
||||
this.updateHTML_(null);
|
||||
};
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.setMap = function (map) {
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(listen(viewport, EventType.POINTERMOVE, this.handleMouseMove, this));
|
||||
if (this.renderOnMouseOut_) {
|
||||
this.listenerKeys.push(listen(viewport, EventType.POINTEROUT, this.handleMouseOut, this));
|
||||
}
|
||||
this.updateHTML_(null);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Set the coordinate format type used to render the current position.
|
||||
* @param {import("../coordinate.js").CoordinateFormat} format The format to render the current
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.setCoordinateFormat = function (format) {
|
||||
this.set(COORDINATE_FORMAT, format);
|
||||
};
|
||||
/**
|
||||
* Set the projection that is used to report the mouse position.
|
||||
* @param {import("../proj.js").ProjectionLike} projection The projection to report mouse
|
||||
* position in.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
MousePosition.prototype.setProjection = function (projection) {
|
||||
this.set(PROJECTION, getProjection(projection));
|
||||
};
|
||||
/**
|
||||
* @param {?import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @private
|
||||
*/
|
||||
MousePosition.prototype.updateHTML_ = function (pixel) {
|
||||
var html = this.placeholder_;
|
||||
if (pixel && this.mapProjection_) {
|
||||
if (!this.transform_) {
|
||||
var projection = this.getProjection();
|
||||
if (projection) {
|
||||
this.transform_ = getTransformFromProjections(this.mapProjection_, projection);
|
||||
}
|
||||
else {
|
||||
this.transform_ = identityTransform;
|
||||
}
|
||||
}
|
||||
var map = this.getMap();
|
||||
var coordinate = map.getCoordinateFromPixelInternal(pixel);
|
||||
if (coordinate) {
|
||||
var userProjection = getUserProjection();
|
||||
if (userProjection) {
|
||||
this.transform_ = getTransformFromProjections(this.mapProjection_, userProjection);
|
||||
}
|
||||
this.transform_(coordinate, coordinate);
|
||||
var coordinateFormat = this.getCoordinateFormat();
|
||||
if (coordinateFormat) {
|
||||
html = coordinateFormat(coordinate);
|
||||
}
|
||||
else {
|
||||
html = coordinate.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.renderedHTML_ || html !== this.renderedHTML_) {
|
||||
this.element.innerHTML = html;
|
||||
this.renderedHTML_ = html;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Update the projection. Rendering of the coordinates is done in
|
||||
* `handleMouseMove` and `handleMouseUp`.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
MousePosition.prototype.render = function (mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.mapProjection_ = null;
|
||||
}
|
||||
else {
|
||||
if (this.mapProjection_ != frameState.viewState.projection) {
|
||||
this.mapProjection_ = frameState.viewState.projection;
|
||||
this.transform_ = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
return MousePosition;
|
||||
}(Control));
|
||||
export default MousePosition;
|
||||
//# sourceMappingURL=MousePosition.js.map
|
||||
1
node_modules/ol/control/MousePosition.js.map
generated
vendored
Normal file
1
node_modules/ol/control/MousePosition.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MousePosition.js","sourceRoot":"","sources":["../src/control/MousePosition.js"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EACL,GAAG,IAAI,aAAa,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,IAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;GAEG;AACH,IAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAE7C;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;GAWG;AACH;IAA4B,iCAAO;IACjC;;OAEG;IACH,uBAAY,WAAW;QAAvB,iBA2FC;QA1FC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/C,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,SAAS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CAAC,CAAC;gBACxC,IAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACpD,IAAI,gBAAgB,EAAE;oBACpB,IAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;iBACrC;qBAAM;oBACL,IAAI,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;iBAC9B;aACF;SACF;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;YACtD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;YAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;IACH,CAAC;IAED;;;;;OAKG;IACH,8BAAM,GAAN,UAAO,QAAQ;QACb,IAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,IAAI,CAAC,UAAU,EAAE;YACf,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;SAC5B;aAAM;YACL,IAAI,IAAI,CAAC,cAAc,IAAI,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE;gBAC1D,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACtD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;aACxB;SACF;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AA9PD,CAA4B,OAAO,GA8PlC;AAED,eAAe,aAAa,CAAC"}
|
||||
252
node_modules/ol/control/OverviewMap.d.ts
generated
vendored
Normal file
252
node_modules/ol/control/OverviewMap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
export default OverviewMap;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Whether the control should start collapsed or not (expanded).
|
||||
*/
|
||||
collapsed?: boolean | undefined;
|
||||
/**
|
||||
* Text label to use for the
|
||||
* expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
collapseLabel?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Whether the control can be collapsed or not.
|
||||
*/
|
||||
collapsible?: boolean | undefined;
|
||||
/**
|
||||
* Text label to use for the collapsed
|
||||
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
label?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Layers for the overview map.
|
||||
*/
|
||||
layers?: import("../layer/Base.js").default[] | import("../Collection.js").default<import("../layer/Base.js").default> | undefined;
|
||||
/**
|
||||
* Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
/**
|
||||
* Whether the control view should rotate with the main map view.
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
/**
|
||||
* Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
tipLabel?: string | undefined;
|
||||
/**
|
||||
* Custom view for the overview map (should use same projection as main map). If not provided,
|
||||
* a default view with the same projection as the main map will be used.
|
||||
*/
|
||||
view?: View | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-overviewmap'] CSS class name.
|
||||
* @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).
|
||||
* @property {string|HTMLElement} [collapseLabel='‹'] Text label to use for the
|
||||
* expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
|
||||
* @property {string|HTMLElement} [label='›'] Text label to use for the collapsed
|
||||
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {Array<import("../layer/Base.js").default>|import("../Collection.js").default<import("../layer/Base.js").default>} [layers]
|
||||
* Layers for the overview map.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {string} [tipLabel='Overview map'] Text label to use for the button tip.
|
||||
* @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,
|
||||
* a default view with the same projection as the main map will be used.
|
||||
*/
|
||||
/**
|
||||
* Create a new control with a map acting as an overview map for another
|
||||
* defined map.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class OverviewMap extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] OverviewMap options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private boundHandleRotationChanged_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private collapsed_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private collapsible_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private rotateWithView_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../extent.js").Extent|undefined}
|
||||
*/
|
||||
private viewExtent_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private collapseLabel_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private label_;
|
||||
/**
|
||||
* @type {HTMLElement}
|
||||
* @private
|
||||
*/
|
||||
private ovmapDiv_;
|
||||
/**
|
||||
* Explicitly given view to be used instead of a view derived from the main map.
|
||||
* @type {View}
|
||||
* @private
|
||||
*/
|
||||
private view_;
|
||||
/**
|
||||
* @type {ControlledMap}
|
||||
* @private
|
||||
*/
|
||||
private ovmap_;
|
||||
/**
|
||||
* @type {import("../Overlay.js").default}
|
||||
* @private
|
||||
*/
|
||||
private boxOverlay_;
|
||||
/**
|
||||
* Handle map property changes. This only deals with changes to the map's view.
|
||||
* @param {import("../Object.js").ObjectEvent} event The propertychange event.
|
||||
* @private
|
||||
*/
|
||||
private handleMapPropertyChange_;
|
||||
/**
|
||||
* Register listeners for view property changes.
|
||||
* @param {import("../View.js").default} view The view.
|
||||
* @private
|
||||
*/
|
||||
private bindView_;
|
||||
/**
|
||||
* Unregister listeners for view property changes.
|
||||
* @param {import("../View.js").default} view The view.
|
||||
* @private
|
||||
*/
|
||||
private unbindView_;
|
||||
/**
|
||||
* Handle rotation changes to the main map.
|
||||
* @private
|
||||
*/
|
||||
private handleRotationChanged_;
|
||||
/**
|
||||
* Reset the overview map extent if the box size (width or
|
||||
* height) is less than the size of the overview map size times minRatio
|
||||
* or is greater than the size of the overview size times maxRatio.
|
||||
*
|
||||
* If the map extent was not reset, the box size can fits in the defined
|
||||
* ratio sizes. This method then checks if is contained inside the overview
|
||||
* map current extent. If not, recenter the overview map to the current
|
||||
* main map center location.
|
||||
* @private
|
||||
*/
|
||||
private validateExtent_;
|
||||
/**
|
||||
* Reset the overview map extent to half calculated min and max ratio times
|
||||
* the extent of the main map.
|
||||
* @private
|
||||
*/
|
||||
private resetExtent_;
|
||||
/**
|
||||
* Set the center of the overview map to the map center without changing its
|
||||
* resolution.
|
||||
* @private
|
||||
*/
|
||||
private recenter_;
|
||||
/**
|
||||
* Update the box using the main map extent
|
||||
* @private
|
||||
*/
|
||||
private updateBox_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private updateBoxAfterOvmapIsRendered_;
|
||||
ovmapPostrenderKey_: any;
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleToggle_;
|
||||
/**
|
||||
* Return `true` if the overview map is collapsible, `false` otherwise.
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
getCollapsible(): boolean;
|
||||
/**
|
||||
* Set whether the overview map should be collapsible.
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
setCollapsible(collapsible: boolean): void;
|
||||
/**
|
||||
* Collapse or expand the overview map according to the passed parameter. Will
|
||||
* not do anything if the overview map isn't collapsible or if the current
|
||||
* collapsed state is already the one requested.
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
setCollapsed(collapsed: boolean): void;
|
||||
/**
|
||||
* Determine if the overview map is collapsed.
|
||||
* @return {boolean} The overview map is collapsed.
|
||||
* @api
|
||||
*/
|
||||
getCollapsed(): boolean;
|
||||
/**
|
||||
* Return `true` if the overview map view can rotate, `false` otherwise.
|
||||
* @return {boolean} True if the control view can rotate.
|
||||
* @api
|
||||
*/
|
||||
getRotateWithView(): boolean;
|
||||
/**
|
||||
* Set whether the overview map view should rotate with the main map view.
|
||||
* @param {boolean} rotateWithView True if the control view should rotate.
|
||||
* @api
|
||||
*/
|
||||
setRotateWithView(rotateWithView: boolean): void;
|
||||
/**
|
||||
* Return the overview map.
|
||||
* @return {import("../PluggableMap.js").default} Overview map.
|
||||
* @api
|
||||
*/
|
||||
getOverviewMap(): import("../PluggableMap.js").default;
|
||||
}
|
||||
import View from "../View.js";
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=OverviewMap.d.ts.map
|
||||
1
node_modules/ol/control/OverviewMap.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/OverviewMap.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"OverviewMap.d.ts","sourceRoot":"","sources":["../src/control/OverviewMap.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAwDuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;;;;;;;;;;;;;;;;;;;AAX7D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,+CA4LC;IAnLC;;OAEG;IACH,oCAAyE;IAEzE;;;OAGG;IACH,mBAC4D;IAE5D;;;OAGG;IACH,qBACgE;IAMhE;;;OAGG;IACH,wBACuE;IAEvE;;;OAGG;IACH,oBAA4B;IAY1B;;;OAGG;IACH,uBAAoD;IASpD;;;OAGG;IACH,eAA4C;IAmB9C;;;OAGG;IACH,kBAA8C;IAG9C;;;;OAIG;IACH,cAAyB;IAEzB;;;OAGG;IACH,eAEE;IAaF;;;OAGG;IACH,oBAIE;IA0GJ;;;;OAIG;IACH,iCAgBC;IAED;;;;OAIG;IACH,kBAeC;IAED;;;;OAIG;IACH,oBAKC;IAED;;;OAGG;IACH,+BAIC;IAED;;;;;;;;;;OAUG;IACH,wBAiDC;IAED;;;;OAIG;IACH,qBAsBC;IAED;;;;OAIG;IACH,kBASC;IAED;;;OAGG;IACH,mBAkCC;IAED;;OAEG;IACH,uCAaC;IATC,yBAQC;IAGH;;;OAGG;IACH,qBAGC;IAED;;OAEG;IACH,sBAsBC;IAED;;;;OAIG;IACH,kBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,QAYjB;IAED;;;;;;OAMG;IACH,wBAHW,OAAO,QAQjB;IAED;;;;OAIG;IACH,gBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,qBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,kCAHW,OAAO,QAkBjB;IAED;;;;OAIG;IACH,kBAHY,OAAO,oBAAoB,EAAE,OAAO,CAK/C;CAWF"}
|
||||
576
node_modules/ol/control/OverviewMap.js
generated
vendored
Normal file
576
node_modules/ol/control/OverviewMap.js
generated
vendored
Normal file
@@ -0,0 +1,576 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/OverviewMap
|
||||
*/
|
||||
import CompositeMapRenderer from '../renderer/Composite.js';
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import MapEventType from '../MapEventType.js';
|
||||
import MapProperty from '../MapProperty.js';
|
||||
import ObjectEventType from '../ObjectEventType.js';
|
||||
import Overlay from '../Overlay.js';
|
||||
import PluggableMap from '../PluggableMap.js';
|
||||
import View from '../View.js';
|
||||
import ViewProperty from '../ViewProperty.js';
|
||||
import { CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { containsExtent, equals as equalsExtent, getBottomRight, getTopLeft, scaleFromCenter, } from '../extent.js';
|
||||
import { listen, listenOnce } from '../events.js';
|
||||
import { fromExtent as polygonFromExtent } from '../geom/Polygon.js';
|
||||
import { replaceNode } from '../dom.js';
|
||||
/**
|
||||
* Maximum width and/or height extent ratio that determines when the overview
|
||||
* map should be zoomed out.
|
||||
* @type {number}
|
||||
*/
|
||||
var MAX_RATIO = 0.75;
|
||||
/**
|
||||
* Minimum width and/or height extent ratio that determines when the overview
|
||||
* map should be zoomed in.
|
||||
* @type {number}
|
||||
*/
|
||||
var MIN_RATIO = 0.1;
|
||||
var ControlledMap = /** @class */ (function (_super) {
|
||||
__extends(ControlledMap, _super);
|
||||
function ControlledMap() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ControlledMap.prototype.createRenderer = function () {
|
||||
return new CompositeMapRenderer(this);
|
||||
};
|
||||
return ControlledMap;
|
||||
}(PluggableMap));
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-overviewmap'] CSS class name.
|
||||
* @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).
|
||||
* @property {string|HTMLElement} [collapseLabel='‹'] Text label to use for the
|
||||
* expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
|
||||
* @property {string|HTMLElement} [label='›'] Text label to use for the collapsed
|
||||
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {Array<import("../layer/Base.js").default>|import("../Collection.js").default<import("../layer/Base.js").default>} [layers]
|
||||
* Layers for the overview map.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {string} [tipLabel='Overview map'] Text label to use for the button tip.
|
||||
* @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,
|
||||
* a default view with the same projection as the main map will be used.
|
||||
*/
|
||||
/**
|
||||
* Create a new control with a map acting as an overview map for another
|
||||
* defined map.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var OverviewMap = /** @class */ (function (_super) {
|
||||
__extends(OverviewMap, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] OverviewMap options.
|
||||
*/
|
||||
function OverviewMap(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
render: options.render,
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_this.boundHandleRotationChanged_ = _this.handleRotationChanged_.bind(_this);
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.collapsed_ =
|
||||
options.collapsed !== undefined ? options.collapsed : true;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.collapsible_ =
|
||||
options.collapsible !== undefined ? options.collapsible : true;
|
||||
if (!_this.collapsible_) {
|
||||
_this.collapsed_ = false;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.rotateWithView_ =
|
||||
options.rotateWithView !== undefined ? options.rotateWithView : false;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../extent.js").Extent|undefined}
|
||||
*/
|
||||
_this.viewExtent_ = undefined;
|
||||
var className = options.className !== undefined ? options.className : 'ol-overviewmap';
|
||||
var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Overview map';
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u2039';
|
||||
if (typeof collapseLabel === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.collapseLabel_ = document.createElement('span');
|
||||
_this.collapseLabel_.textContent = collapseLabel;
|
||||
}
|
||||
else {
|
||||
_this.collapseLabel_ = collapseLabel;
|
||||
}
|
||||
var label = options.label !== undefined ? options.label : '\u203A';
|
||||
if (typeof label === 'string') {
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.label_ = document.createElement('span');
|
||||
_this.label_.textContent = label;
|
||||
}
|
||||
else {
|
||||
_this.label_ = label;
|
||||
}
|
||||
var activeLabel = _this.collapsible_ && !_this.collapsed_ ? _this.collapseLabel_ : _this.label_;
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(activeLabel);
|
||||
button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
|
||||
/**
|
||||
* @type {HTMLElement}
|
||||
* @private
|
||||
*/
|
||||
_this.ovmapDiv_ = document.createElement('div');
|
||||
_this.ovmapDiv_.className = 'ol-overviewmap-map';
|
||||
/**
|
||||
* Explicitly given view to be used instead of a view derived from the main map.
|
||||
* @type {View}
|
||||
* @private
|
||||
*/
|
||||
_this.view_ = options.view;
|
||||
/**
|
||||
* @type {ControlledMap}
|
||||
* @private
|
||||
*/
|
||||
_this.ovmap_ = new ControlledMap({
|
||||
view: options.view,
|
||||
});
|
||||
var ovmap = _this.ovmap_;
|
||||
if (options.layers) {
|
||||
options.layers.forEach(function (layer) {
|
||||
ovmap.addLayer(layer);
|
||||
});
|
||||
}
|
||||
var box = document.createElement('div');
|
||||
box.className = 'ol-overviewmap-box';
|
||||
box.style.boxSizing = 'border-box';
|
||||
/**
|
||||
* @type {import("../Overlay.js").default}
|
||||
* @private
|
||||
*/
|
||||
_this.boxOverlay_ = new Overlay({
|
||||
position: [0, 0],
|
||||
positioning: 'center-center',
|
||||
element: box,
|
||||
});
|
||||
_this.ovmap_.addOverlay(_this.boxOverlay_);
|
||||
var cssClasses = className +
|
||||
' ' +
|
||||
CLASS_UNSELECTABLE +
|
||||
' ' +
|
||||
CLASS_CONTROL +
|
||||
(_this.collapsed_ && _this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +
|
||||
(_this.collapsible_ ? '' : ' ol-uncollapsible');
|
||||
var element = _this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(_this.ovmapDiv_);
|
||||
element.appendChild(button);
|
||||
/* Interactive map */
|
||||
var scope = _this;
|
||||
var overlay = _this.boxOverlay_;
|
||||
var overlayBox = _this.boxOverlay_.getElement();
|
||||
/* Functions definition */
|
||||
var computeDesiredMousePosition = function (mousePosition) {
|
||||
return {
|
||||
clientX: mousePosition.clientX,
|
||||
clientY: mousePosition.clientY,
|
||||
};
|
||||
};
|
||||
var move = function (event) {
|
||||
var position = /** @type {?} */ (computeDesiredMousePosition(event));
|
||||
var coordinates = ovmap.getEventCoordinateInternal(
|
||||
/** @type {MouseEvent} */ (position));
|
||||
overlay.setPosition(coordinates);
|
||||
};
|
||||
var endMoving = function (event) {
|
||||
var coordinates = ovmap.getEventCoordinateInternal(event);
|
||||
scope.getMap().getView().setCenterInternal(coordinates);
|
||||
window.removeEventListener('mousemove', move);
|
||||
window.removeEventListener('mouseup', endMoving);
|
||||
};
|
||||
/* Binding */
|
||||
overlayBox.addEventListener('mousedown', function () {
|
||||
window.addEventListener('mousemove', move);
|
||||
window.addEventListener('mouseup', endMoving);
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.setMap = function (map) {
|
||||
var oldMap = this.getMap();
|
||||
if (map === oldMap) {
|
||||
return;
|
||||
}
|
||||
if (oldMap) {
|
||||
var oldView = oldMap.getView();
|
||||
if (oldView) {
|
||||
this.unbindView_(oldView);
|
||||
}
|
||||
this.ovmap_.setTarget(null);
|
||||
}
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
this.ovmap_.setTarget(this.ovmapDiv_);
|
||||
this.listenerKeys.push(listen(map, ObjectEventType.PROPERTYCHANGE, this.handleMapPropertyChange_, this));
|
||||
var view = map.getView();
|
||||
if (view) {
|
||||
this.bindView_(view);
|
||||
if (view.isDef()) {
|
||||
this.ovmap_.updateSize();
|
||||
this.resetExtent_();
|
||||
}
|
||||
}
|
||||
if (!this.ovmap_.isRendered()) {
|
||||
this.updateBoxAfterOvmapIsRendered_();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle map property changes. This only deals with changes to the map's view.
|
||||
* @param {import("../Object.js").ObjectEvent} event The propertychange event.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.handleMapPropertyChange_ = function (event) {
|
||||
if (event.key === MapProperty.VIEW) {
|
||||
var oldView = /** @type {import("../View.js").default} */ (event.oldValue);
|
||||
if (oldView) {
|
||||
this.unbindView_(oldView);
|
||||
}
|
||||
var newView = this.getMap().getView();
|
||||
this.bindView_(newView);
|
||||
}
|
||||
else if (!this.ovmap_.isRendered() &&
|
||||
(event.key === MapProperty.TARGET || event.key === MapProperty.SIZE)) {
|
||||
this.ovmap_.updateSize();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Register listeners for view property changes.
|
||||
* @param {import("../View.js").default} view The view.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.bindView_ = function (view) {
|
||||
if (!this.view_) {
|
||||
// Unless an explicit view definition was given, derive default from whatever main map uses.
|
||||
var newView = new View({
|
||||
projection: view.getProjection(),
|
||||
});
|
||||
this.ovmap_.setView(newView);
|
||||
}
|
||||
view.addChangeListener(ViewProperty.ROTATION, this.boundHandleRotationChanged_);
|
||||
// Sync once with the new view
|
||||
this.handleRotationChanged_();
|
||||
};
|
||||
/**
|
||||
* Unregister listeners for view property changes.
|
||||
* @param {import("../View.js").default} view The view.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.unbindView_ = function (view) {
|
||||
view.removeChangeListener(ViewProperty.ROTATION, this.boundHandleRotationChanged_);
|
||||
};
|
||||
/**
|
||||
* Handle rotation changes to the main map.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.handleRotationChanged_ = function () {
|
||||
if (this.rotateWithView_) {
|
||||
this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Reset the overview map extent if the box size (width or
|
||||
* height) is less than the size of the overview map size times minRatio
|
||||
* or is greater than the size of the overview size times maxRatio.
|
||||
*
|
||||
* If the map extent was not reset, the box size can fits in the defined
|
||||
* ratio sizes. This method then checks if is contained inside the overview
|
||||
* map current extent. If not, recenter the overview map to the current
|
||||
* main map center location.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.validateExtent_ = function () {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
if (!map.isRendered() || !ovmap.isRendered()) {
|
||||
return;
|
||||
}
|
||||
var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
|
||||
var view = map.getView();
|
||||
var extent = view.calculateExtentInternal(mapSize);
|
||||
if (this.viewExtent_ && equalsExtent(extent, this.viewExtent_)) {
|
||||
// repeats of the same extent may indicate constraint conflicts leading to an endless cycle
|
||||
return;
|
||||
}
|
||||
this.viewExtent_ = extent;
|
||||
var ovmapSize = /** @type {import("../size.js").Size} */ (ovmap.getSize());
|
||||
var ovview = ovmap.getView();
|
||||
var ovextent = ovview.calculateExtentInternal(ovmapSize);
|
||||
var topLeftPixel = ovmap.getPixelFromCoordinateInternal(getTopLeft(extent));
|
||||
var bottomRightPixel = ovmap.getPixelFromCoordinateInternal(getBottomRight(extent));
|
||||
var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);
|
||||
var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);
|
||||
var ovmapWidth = ovmapSize[0];
|
||||
var ovmapHeight = ovmapSize[1];
|
||||
if (boxWidth < ovmapWidth * MIN_RATIO ||
|
||||
boxHeight < ovmapHeight * MIN_RATIO ||
|
||||
boxWidth > ovmapWidth * MAX_RATIO ||
|
||||
boxHeight > ovmapHeight * MAX_RATIO) {
|
||||
this.resetExtent_();
|
||||
}
|
||||
else if (!containsExtent(ovextent, extent)) {
|
||||
this.recenter_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Reset the overview map extent to half calculated min and max ratio times
|
||||
* the extent of the main map.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.resetExtent_ = function () {
|
||||
if (MAX_RATIO === 0 || MIN_RATIO === 0) {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
|
||||
var view = map.getView();
|
||||
var extent = view.calculateExtentInternal(mapSize);
|
||||
var ovview = ovmap.getView();
|
||||
// get how many times the current map overview could hold different
|
||||
// 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(MAX_RATIO / MIN_RATIO) / Math.LN2;
|
||||
var ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);
|
||||
scaleFromCenter(extent, ratio);
|
||||
ovview.fitInternal(polygonFromExtent(extent));
|
||||
};
|
||||
/**
|
||||
* Set the center of the overview map to the map center without changing its
|
||||
* resolution.
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.recenter_ = function () {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
var view = map.getView();
|
||||
var ovview = ovmap.getView();
|
||||
ovview.setCenterInternal(view.getCenterInternal());
|
||||
};
|
||||
/**
|
||||
* Update the box using the main map extent
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.updateBox_ = function () {
|
||||
var map = this.getMap();
|
||||
var ovmap = this.ovmap_;
|
||||
if (!map.isRendered() || !ovmap.isRendered()) {
|
||||
return;
|
||||
}
|
||||
var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
|
||||
var view = map.getView();
|
||||
var ovview = ovmap.getView();
|
||||
var rotation = this.rotateWithView_ ? 0 : -view.getRotation();
|
||||
var overlay = this.boxOverlay_;
|
||||
var box = this.boxOverlay_.getElement();
|
||||
var center = view.getCenterInternal();
|
||||
var resolution = view.getResolution();
|
||||
var ovresolution = ovview.getResolution();
|
||||
var width = (mapSize[0] * resolution) / ovresolution;
|
||||
var height = (mapSize[1] * resolution) / ovresolution;
|
||||
// set position using center coordinates
|
||||
overlay.setPosition(center);
|
||||
// set box size calculated from map extent size and overview map resolution
|
||||
if (box) {
|
||||
box.style.width = width + 'px';
|
||||
box.style.height = height + 'px';
|
||||
var transform = 'rotate(' + rotation + 'rad)';
|
||||
box.style.transform = transform;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.updateBoxAfterOvmapIsRendered_ = function () {
|
||||
if (this.ovmapPostrenderKey_) {
|
||||
return;
|
||||
}
|
||||
this.ovmapPostrenderKey_ = listenOnce(this.ovmap_, MapEventType.POSTRENDER, function (event) {
|
||||
delete this.ovmapPostrenderKey_;
|
||||
this.updateBox_();
|
||||
}, this);
|
||||
};
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.handleClick_ = function (event) {
|
||||
event.preventDefault();
|
||||
this.handleToggle_();
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
OverviewMap.prototype.handleToggle_ = function () {
|
||||
this.element.classList.toggle(CLASS_COLLAPSED);
|
||||
if (this.collapsed_) {
|
||||
replaceNode(this.collapseLabel_, this.label_);
|
||||
}
|
||||
else {
|
||||
replaceNode(this.label_, this.collapseLabel_);
|
||||
}
|
||||
this.collapsed_ = !this.collapsed_;
|
||||
// manage overview map if it had not been rendered before and control
|
||||
// is expanded
|
||||
var ovmap = this.ovmap_;
|
||||
if (!this.collapsed_) {
|
||||
if (ovmap.isRendered()) {
|
||||
this.viewExtent_ = undefined;
|
||||
ovmap.render();
|
||||
return;
|
||||
}
|
||||
ovmap.updateSize();
|
||||
this.resetExtent_();
|
||||
this.updateBoxAfterOvmapIsRendered_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Return `true` if the overview map is collapsible, `false` otherwise.
|
||||
* @return {boolean} True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.getCollapsible = function () {
|
||||
return this.collapsible_;
|
||||
};
|
||||
/**
|
||||
* Set whether the overview map should be collapsible.
|
||||
* @param {boolean} collapsible True if the widget is collapsible.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.setCollapsible = function (collapsible) {
|
||||
if (this.collapsible_ === collapsible) {
|
||||
return;
|
||||
}
|
||||
this.collapsible_ = collapsible;
|
||||
this.element.classList.toggle('ol-uncollapsible');
|
||||
if (!collapsible && this.collapsed_) {
|
||||
this.handleToggle_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Collapse or expand the overview map according to the passed parameter. Will
|
||||
* not do anything if the overview map isn't collapsible or if the current
|
||||
* collapsed state is already the one requested.
|
||||
* @param {boolean} collapsed True if the widget is collapsed.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.setCollapsed = function (collapsed) {
|
||||
if (!this.collapsible_ || this.collapsed_ === collapsed) {
|
||||
return;
|
||||
}
|
||||
this.handleToggle_();
|
||||
};
|
||||
/**
|
||||
* Determine if the overview map is collapsed.
|
||||
* @return {boolean} The overview map is collapsed.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.getCollapsed = function () {
|
||||
return this.collapsed_;
|
||||
};
|
||||
/**
|
||||
* Return `true` if the overview map view can rotate, `false` otherwise.
|
||||
* @return {boolean} True if the control view can rotate.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.getRotateWithView = function () {
|
||||
return this.rotateWithView_;
|
||||
};
|
||||
/**
|
||||
* Set whether the overview map view should rotate with the main map view.
|
||||
* @param {boolean} rotateWithView True if the control view should rotate.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.setRotateWithView = function (rotateWithView) {
|
||||
if (this.rotateWithView_ === rotateWithView) {
|
||||
return;
|
||||
}
|
||||
this.rotateWithView_ = rotateWithView;
|
||||
if (this.getMap().getView().getRotation() !== 0) {
|
||||
if (this.rotateWithView_) {
|
||||
this.handleRotationChanged_();
|
||||
}
|
||||
else {
|
||||
this.ovmap_.getView().setRotation(0);
|
||||
}
|
||||
this.viewExtent_ = undefined;
|
||||
this.validateExtent_();
|
||||
this.updateBox_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Return the overview map.
|
||||
* @return {import("../PluggableMap.js").default} Overview map.
|
||||
* @api
|
||||
*/
|
||||
OverviewMap.prototype.getOverviewMap = function () {
|
||||
return this.ovmap_;
|
||||
};
|
||||
/**
|
||||
* Update the overview map element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
OverviewMap.prototype.render = function (mapEvent) {
|
||||
this.validateExtent_();
|
||||
this.updateBox_();
|
||||
};
|
||||
return OverviewMap;
|
||||
}(Control));
|
||||
export default OverviewMap;
|
||||
//# sourceMappingURL=OverviewMap.js.map
|
||||
1
node_modules/ol/control/OverviewMap.js.map
generated
vendored
Normal file
1
node_modules/ol/control/OverviewMap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
105
node_modules/ol/control/Rotate.d.ts
generated
vendored
Normal file
105
node_modules/ol/control/Rotate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
export default Rotate;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the rotate button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
label?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the rotate tip.
|
||||
*/
|
||||
tipLabel?: string | undefined;
|
||||
/**
|
||||
* CSS class name for the compass.
|
||||
*/
|
||||
compassClassName?: string | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* Hide the control when rotation is 0.
|
||||
*/
|
||||
autoHide?: boolean | undefined;
|
||||
/**
|
||||
* Function called when the control should
|
||||
* be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
/**
|
||||
* Function called when the control is clicked.
|
||||
* This will override the default `resetNorth`.
|
||||
*/
|
||||
resetNorth?: (() => void) | undefined;
|
||||
/**
|
||||
* Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-rotate'] CSS class name.
|
||||
* @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.
|
||||
* @property {string} [compassClassName='ol-compass'] CSS class name for the compass.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {boolean} [autoHide=true] Hide the control when rotation is 0.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control should
|
||||
* be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {function():void} [resetNorth] Function called when the control is clicked.
|
||||
* This will override the default `resetNorth`.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control to reset rotation to 0.
|
||||
* To style this control use css selector `.ol-rotate`. A `.ol-hidden` css
|
||||
* selector is added to the button when the rotation is 0.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Rotate extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Rotate options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {HTMLElement}
|
||||
* @private
|
||||
*/
|
||||
private label_;
|
||||
callResetNorth_: (() => void) | undefined;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private autoHide_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private rotation_;
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private resetNorth_;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=Rotate.d.ts.map
|
||||
1
node_modules/ol/control/Rotate.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/Rotate.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Rotate.d.ts","sourceRoot":"","sources":["../src/control/Rotate.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAiBuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;;;;wBAEpC,IAAI;;;;;;;AAX7B;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,+CA6EC;IA1DC;;;OAGG;IACH,eAAkB;IA+BlB,wBAxEqB,IAAI,cAwEiD;IAE1E;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,kBAAyE;IAEzE;;;OAGG;IACH,kBAA0B;IAO5B;;;OAGG;IACH,qBAOC;IAED;;OAEG;IACH,oBAoBC;CA2BF"}
|
||||
178
node_modules/ol/control/Rotate.js
generated
vendored
Normal file
178
node_modules/ol/control/Rotate.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/Rotate
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import { CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { easeOut } from '../easing.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-rotate'] CSS class name.
|
||||
* @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.
|
||||
* @property {string} [compassClassName='ol-compass'] CSS class name for the compass.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {boolean} [autoHide=true] Hide the control when rotation is 0.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control should
|
||||
* be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {function():void} [resetNorth] Function called when the control is clicked.
|
||||
* This will override the default `resetNorth`.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control to reset rotation to 0.
|
||||
* To style this control use css selector `.ol-rotate`. A `.ol-hidden` css
|
||||
* selector is added to the button when the rotation is 0.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Rotate = /** @class */ (function (_super) {
|
||||
__extends(Rotate, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Rotate options.
|
||||
*/
|
||||
function Rotate(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
render: options.render,
|
||||
target: options.target,
|
||||
}) || this;
|
||||
var className = options.className !== undefined ? options.className : 'ol-rotate';
|
||||
var label = options.label !== undefined ? options.label : '\u21E7';
|
||||
var compassClassName = options.compassClassName !== undefined
|
||||
? options.compassClassName
|
||||
: 'ol-compass';
|
||||
/**
|
||||
* @type {HTMLElement}
|
||||
* @private
|
||||
*/
|
||||
_this.label_ = null;
|
||||
if (typeof label === 'string') {
|
||||
_this.label_ = document.createElement('span');
|
||||
_this.label_.className = compassClassName;
|
||||
_this.label_.textContent = label;
|
||||
}
|
||||
else {
|
||||
_this.label_ = label;
|
||||
_this.label_.classList.add(compassClassName);
|
||||
}
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
|
||||
var button = document.createElement('button');
|
||||
button.className = className + '-reset';
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(_this.label_);
|
||||
button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
|
||||
var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
var element = _this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
_this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.rotation_ = undefined;
|
||||
if (_this.autoHide_) {
|
||||
_this.element.classList.add(CLASS_HIDDEN);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
Rotate.prototype.handleClick_ = function (event) {
|
||||
event.preventDefault();
|
||||
if (this.callResetNorth_ !== undefined) {
|
||||
this.callResetNorth_();
|
||||
}
|
||||
else {
|
||||
this.resetNorth_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Rotate.prototype.resetNorth_ = function () {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
}
|
||||
var rotation = view.getRotation();
|
||||
if (rotation !== undefined) {
|
||||
if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {
|
||||
view.animate({
|
||||
rotation: 0,
|
||||
duration: this.duration_,
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
else {
|
||||
view.setRotation(0);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Update the rotate control element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
Rotate.prototype.render = function (mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
return;
|
||||
}
|
||||
var rotation = frameState.viewState.rotation;
|
||||
if (rotation != this.rotation_) {
|
||||
var transform = 'rotate(' + rotation + 'rad)';
|
||||
if (this.autoHide_) {
|
||||
var contains = this.element.classList.contains(CLASS_HIDDEN);
|
||||
if (!contains && rotation === 0) {
|
||||
this.element.classList.add(CLASS_HIDDEN);
|
||||
}
|
||||
else if (contains && rotation !== 0) {
|
||||
this.element.classList.remove(CLASS_HIDDEN);
|
||||
}
|
||||
}
|
||||
this.label_.style.transform = transform;
|
||||
}
|
||||
this.rotation_ = rotation;
|
||||
};
|
||||
return Rotate;
|
||||
}(Control));
|
||||
export default Rotate;
|
||||
//# sourceMappingURL=Rotate.js.map
|
||||
1
node_modules/ol/control/Rotate.js.map
generated
vendored
Normal file
1
node_modules/ol/control/Rotate.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Rotate.js","sourceRoot":"","sources":["../src/control/Rotate.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH;IAAqB,0BAAO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,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC/D,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,CAAC,EAAE;oBAC/B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;iBAC1C;qBAAM,IAAI,QAAQ,IAAI,QAAQ,KAAK,CAAC,EAAE;oBACrC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;iBAC7C;aACF;YACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;SACzC;QACD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACH,aAAC;AAAD,CAAC,AAlJD,CAAqB,OAAO,GAkJ3B;AAED,eAAe,MAAM,CAAC"}
|
||||
242
node_modules/ol/control/ScaleLine.d.ts
generated
vendored
Normal file
242
node_modules/ol/control/ScaleLine.d.ts
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/**
|
||||
* Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
|
||||
* `'nautical'`, `'metric'`, `'us'`.
|
||||
*/
|
||||
export type Units = string;
|
||||
export namespace Units {
|
||||
const DEGREES: string;
|
||||
const IMPERIAL: string;
|
||||
const NAUTICAL: string;
|
||||
const METRIC: string;
|
||||
const US: string;
|
||||
}
|
||||
export default ScaleLine;
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type ScaleLineOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:units', import("../Object").ObjectEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:units', Return>;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS Class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Minimum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
*/
|
||||
minWidth?: number | undefined;
|
||||
/**
|
||||
* Maximum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
*/
|
||||
maxWidth?: number | undefined;
|
||||
/**
|
||||
* Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
/**
|
||||
* Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Units.
|
||||
*/
|
||||
units?: string | undefined;
|
||||
/**
|
||||
* Render scalebars instead of a line.
|
||||
*/
|
||||
bar?: boolean | undefined;
|
||||
/**
|
||||
* Number of steps the scalebar should use. Use even numbers
|
||||
* for best results. Only applies when `bar` is `true`.
|
||||
*/
|
||||
steps?: number | undefined;
|
||||
/**
|
||||
* Render the text scale above of the scalebar. Only applies
|
||||
* when `bar` is `true`.
|
||||
*/
|
||||
text?: boolean | undefined;
|
||||
/**
|
||||
* dpi of output device such as printer. Only applies
|
||||
* when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.
|
||||
*/
|
||||
dpi?: number | undefined;
|
||||
};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:units', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types
|
||||
* |'change:units', Return>} ScaleLineOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-scale-line'] CSS Class name.
|
||||
* @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
* @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {import("./ScaleLine.js").Units|string} [units='metric'] Units.
|
||||
* @property {boolean} [bar=false] Render scalebars instead of a line.
|
||||
* @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers
|
||||
* for best results. Only applies when `bar` is `true`.
|
||||
* @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies
|
||||
* when `bar` is `true`.
|
||||
* @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies
|
||||
* when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control displaying rough y-axis distances, calculated for the center of the
|
||||
* viewport. For conformal projections (e.g. EPSG:3857, the default view
|
||||
* projection in OpenLayers), the scale is valid for all directions.
|
||||
* No scale line will be shown when the y-axis distance of a pixel at the
|
||||
* viewport center cannot be calculated in the view projection.
|
||||
* By default the scale line will show in the bottom left portion of the map,
|
||||
* but this can be changed by using the css selector `.ol-scale-line`.
|
||||
* When specifying `bar` as `true`, a scalebar will be rendered instead
|
||||
* of a scaleline.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class ScaleLine extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Scale line options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: ScaleLineOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: ScaleLineOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<void>}
|
||||
*/
|
||||
un: ScaleLineOnSignature<void>;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
private innerElement_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../View.js").State}
|
||||
*/
|
||||
private viewState_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private minWidth_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private maxWidth_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private renderedVisible_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private renderedWidth_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
private renderedHTML_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private scaleBar_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private scaleBarSteps_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private scaleBarText_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private dpi_;
|
||||
/**
|
||||
* Return the units to use in the scale line.
|
||||
* @return {import("./ScaleLine.js").Units} The units
|
||||
* to use in the scale line.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
getUnits(): import("./ScaleLine.js").Units;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleUnitsChanged_;
|
||||
/**
|
||||
* Set the units to use in the scale line.
|
||||
* @param {import("./ScaleLine.js").Units} units The units to use in the scale line.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setUnits(units: import("./ScaleLine.js").Units): void;
|
||||
/**
|
||||
* Specify the dpi of output device such as printer.
|
||||
* @param {number|undefined} dpi The dpi of output device.
|
||||
* @api
|
||||
*/
|
||||
setDpi(dpi: number | undefined): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private updateElement_;
|
||||
/**
|
||||
* @private
|
||||
* @param {number} width The current width of the scalebar.
|
||||
* @param {number} scale The current scale.
|
||||
* @param {string} suffix The suffix to append to the scale text.
|
||||
* @return {string} The stringified HTML of the scalebar.
|
||||
*/
|
||||
private createScaleBar;
|
||||
/**
|
||||
* Creates a marker at given position
|
||||
* @param {string} position The position, absolute or relative
|
||||
* @param {number} i The iterator
|
||||
* @return {string} The stringified div containing the marker
|
||||
*/
|
||||
createMarker(position: string, i: number): string;
|
||||
/**
|
||||
* Creates the label for a marker marker at given position
|
||||
* @param {number} i The iterator
|
||||
* @param {number} width The width the scalebar will currently use
|
||||
* @param {boolean} isLast Flag indicating if we add the last step text
|
||||
* @param {number} scale The current scale for the whole scalebar
|
||||
* @param {string} suffix The suffix for the scale
|
||||
* @return {string} The stringified div containing the step text
|
||||
*/
|
||||
createStepText(i: number, width: number, isLast: boolean, scale: number, suffix: string): string;
|
||||
/**
|
||||
* Returns the appropriate scale for the given resolution and units.
|
||||
* @return {number} The appropriate scale.
|
||||
*/
|
||||
getScaleForResolution(): number;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=ScaleLine.d.ts.map
|
||||
1
node_modules/ol/control/ScaleLine.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/ScaleLine.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ScaleLine.d.ts","sourceRoot":"","sources":["../src/control/ScaleLine.js"],"names":[],"mappings":";;;;oBAiBU,MAAM;;;;;;;;;;;;2CAwBH,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACjI,OAAW,eAAe,EAAE,WAAW,CAAC,OAAO,oBAAoB,EAAE,KAAK,GAC1E,cAAoB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC9D,OAAW,eAAe,EA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AM,UACN,MAAM,GACL,MAAM,CA4BjB;IAED;;;OAGG;IACH,yBAFY,MAAM,CAYjB;CAgBF"}
|
||||
500
node_modules/ol/control/ScaleLine.js
generated
vendored
Normal file
500
node_modules/ol/control/ScaleLine.js
generated
vendored
Normal file
@@ -0,0 +1,500 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/ScaleLine
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import ProjUnits from '../proj/Units.js';
|
||||
import { CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { METERS_PER_UNIT, getPointResolution } from '../proj.js';
|
||||
import { assert } from '../asserts.js';
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
var UNITS_PROP = 'units';
|
||||
/**
|
||||
* Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
|
||||
* `'nautical'`, `'metric'`, `'us'`.
|
||||
* @enum {string}
|
||||
*/
|
||||
export var Units = {
|
||||
DEGREES: 'degrees',
|
||||
IMPERIAL: 'imperial',
|
||||
NAUTICAL: 'nautical',
|
||||
METRIC: 'metric',
|
||||
US: 'us',
|
||||
};
|
||||
/**
|
||||
* @const
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
var LEADING_DIGITS = [1, 2, 5];
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
var DEFAULT_DPI = 25.4 / 0.28;
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:units', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types
|
||||
* |'change:units', Return>} ScaleLineOnSignature
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-scale-line'] CSS Class name.
|
||||
* @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
* @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be
|
||||
* adjusted to match the dpi used.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {import("./ScaleLine.js").Units|string} [units='metric'] Units.
|
||||
* @property {boolean} [bar=false] Render scalebars instead of a line.
|
||||
* @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers
|
||||
* for best results. Only applies when `bar` is `true`.
|
||||
* @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies
|
||||
* when `bar` is `true`.
|
||||
* @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies
|
||||
* when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control displaying rough y-axis distances, calculated for the center of the
|
||||
* viewport. For conformal projections (e.g. EPSG:3857, the default view
|
||||
* projection in OpenLayers), the scale is valid for all directions.
|
||||
* No scale line will be shown when the y-axis distance of a pixel at the
|
||||
* viewport center cannot be calculated in the view projection.
|
||||
* By default the scale line will show in the bottom left portion of the map,
|
||||
* but this can be changed by using the css selector `.ol-scale-line`.
|
||||
* When specifying `bar` as `true`, a scalebar will be rendered instead
|
||||
* of a scaleline.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var ScaleLine = /** @class */ (function (_super) {
|
||||
__extends(ScaleLine, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Scale line options.
|
||||
*/
|
||||
function ScaleLine(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var className = options.className !== undefined
|
||||
? options.className
|
||||
: options.bar
|
||||
? 'ol-scale-bar'
|
||||
: 'ol-scale-line';
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
render: options.render,
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {ScaleLineOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement}
|
||||
*/
|
||||
_this.innerElement_ = document.createElement('div');
|
||||
_this.innerElement_.className = className + '-inner';
|
||||
_this.element.className = className + ' ' + CLASS_UNSELECTABLE;
|
||||
_this.element.appendChild(_this.innerElement_);
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../View.js").State}
|
||||
*/
|
||||
_this.viewState_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.maxWidth_ = options.maxWidth;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.renderedVisible_ = false;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.renderedWidth_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
_this.renderedHTML_ = '';
|
||||
_this.addChangeListener(UNITS_PROP, _this.handleUnitsChanged_);
|
||||
_this.setUnits(options.units || Units.METRIC);
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.scaleBar_ = options.bar || false;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.scaleBarSteps_ = options.steps || 4;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.scaleBarText_ = options.text || false;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.dpi_ = options.dpi || undefined;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Return the units to use in the scale line.
|
||||
* @return {import("./ScaleLine.js").Units} The units
|
||||
* to use in the scale line.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ScaleLine.prototype.getUnits = function () {
|
||||
return this.get(UNITS_PROP);
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ScaleLine.prototype.handleUnitsChanged_ = function () {
|
||||
this.updateElement_();
|
||||
};
|
||||
/**
|
||||
* Set the units to use in the scale line.
|
||||
* @param {import("./ScaleLine.js").Units} units The units to use in the scale line.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
ScaleLine.prototype.setUnits = function (units) {
|
||||
this.set(UNITS_PROP, units);
|
||||
};
|
||||
/**
|
||||
* Specify the dpi of output device such as printer.
|
||||
* @param {number|undefined} dpi The dpi of output device.
|
||||
* @api
|
||||
*/
|
||||
ScaleLine.prototype.setDpi = function (dpi) {
|
||||
this.dpi_ = dpi;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ScaleLine.prototype.updateElement_ = function () {
|
||||
var viewState = this.viewState_;
|
||||
if (!viewState) {
|
||||
if (this.renderedVisible_) {
|
||||
this.element.style.display = 'none';
|
||||
this.renderedVisible_ = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var center = viewState.center;
|
||||
var projection = viewState.projection;
|
||||
var units = this.getUnits();
|
||||
var pointResolutionUnits = units == Units.DEGREES ? ProjUnits.DEGREES : ProjUnits.METERS;
|
||||
var pointResolution = getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
|
||||
var minWidth = (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;
|
||||
var maxWidth = this.maxWidth_ !== undefined
|
||||
? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI
|
||||
: undefined;
|
||||
var nominalCount = minWidth * pointResolution;
|
||||
var suffix = '';
|
||||
if (units == Units.DEGREES) {
|
||||
var metersPerDegree = METERS_PER_UNIT[ProjUnits.DEGREES];
|
||||
nominalCount *= metersPerDegree;
|
||||
if (nominalCount < metersPerDegree / 60) {
|
||||
suffix = '\u2033'; // seconds
|
||||
pointResolution *= 3600;
|
||||
}
|
||||
else if (nominalCount < metersPerDegree) {
|
||||
suffix = '\u2032'; // minutes
|
||||
pointResolution *= 60;
|
||||
}
|
||||
else {
|
||||
suffix = '\u00b0'; // degrees
|
||||
}
|
||||
}
|
||||
else if (units == Units.IMPERIAL) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution /= 0.0254;
|
||||
}
|
||||
else if (nominalCount < 1609.344) {
|
||||
suffix = 'ft';
|
||||
pointResolution /= 0.3048;
|
||||
}
|
||||
else {
|
||||
suffix = 'mi';
|
||||
pointResolution /= 1609.344;
|
||||
}
|
||||
}
|
||||
else if (units == Units.NAUTICAL) {
|
||||
pointResolution /= 1852;
|
||||
suffix = 'NM';
|
||||
}
|
||||
else if (units == Units.METRIC) {
|
||||
if (nominalCount < 0.001) {
|
||||
suffix = 'μm';
|
||||
pointResolution *= 1000000;
|
||||
}
|
||||
else if (nominalCount < 1) {
|
||||
suffix = 'mm';
|
||||
pointResolution *= 1000;
|
||||
}
|
||||
else if (nominalCount < 1000) {
|
||||
suffix = 'm';
|
||||
}
|
||||
else {
|
||||
suffix = 'km';
|
||||
pointResolution /= 1000;
|
||||
}
|
||||
}
|
||||
else if (units == Units.US) {
|
||||
if (nominalCount < 0.9144) {
|
||||
suffix = 'in';
|
||||
pointResolution *= 39.37;
|
||||
}
|
||||
else if (nominalCount < 1609.344) {
|
||||
suffix = 'ft';
|
||||
pointResolution /= 0.30480061;
|
||||
}
|
||||
else {
|
||||
suffix = 'mi';
|
||||
pointResolution /= 1609.3472;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(false, 33); // Invalid units
|
||||
}
|
||||
var i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));
|
||||
var count, width, decimalCount;
|
||||
var previousCount, previousWidth, previousDecimalCount;
|
||||
while (true) {
|
||||
decimalCount = Math.floor(i / 3);
|
||||
var decimal = Math.pow(10, decimalCount);
|
||||
count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;
|
||||
width = Math.round(count / pointResolution);
|
||||
if (isNaN(width)) {
|
||||
this.element.style.display = 'none';
|
||||
this.renderedVisible_ = false;
|
||||
return;
|
||||
}
|
||||
if (maxWidth !== undefined && width >= maxWidth) {
|
||||
count = previousCount;
|
||||
width = previousWidth;
|
||||
decimalCount = previousDecimalCount;
|
||||
break;
|
||||
}
|
||||
else if (width >= minWidth) {
|
||||
break;
|
||||
}
|
||||
previousCount = count;
|
||||
previousWidth = width;
|
||||
previousDecimalCount = decimalCount;
|
||||
++i;
|
||||
}
|
||||
var html;
|
||||
if (this.scaleBar_) {
|
||||
html = this.createScaleBar(width, count, suffix);
|
||||
}
|
||||
else {
|
||||
html = count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
|
||||
}
|
||||
if (this.renderedHTML_ != html) {
|
||||
this.innerElement_.innerHTML = html;
|
||||
this.renderedHTML_ = html;
|
||||
}
|
||||
if (this.renderedWidth_ != width) {
|
||||
this.innerElement_.style.width = width + 'px';
|
||||
this.renderedWidth_ = width;
|
||||
}
|
||||
if (!this.renderedVisible_) {
|
||||
this.element.style.display = '';
|
||||
this.renderedVisible_ = true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {number} width The current width of the scalebar.
|
||||
* @param {number} scale The current scale.
|
||||
* @param {string} suffix The suffix to append to the scale text.
|
||||
* @return {string} The stringified HTML of the scalebar.
|
||||
*/
|
||||
ScaleLine.prototype.createScaleBar = function (width, scale, suffix) {
|
||||
var mapScale = '1 : ' + Math.round(this.getScaleForResolution()).toLocaleString();
|
||||
var scaleSteps = [];
|
||||
var stepWidth = width / this.scaleBarSteps_;
|
||||
var backgroundColor = 'ol-scale-singlebar-odd';
|
||||
for (var i = 0; i < this.scaleBarSteps_; i++) {
|
||||
if (i === 0) {
|
||||
// create the first marker at position 0
|
||||
scaleSteps.push(this.createMarker('absolute', i));
|
||||
}
|
||||
scaleSteps.push('<div>' +
|
||||
'<div ' +
|
||||
'class="ol-scale-singlebar ' +
|
||||
backgroundColor +
|
||||
'" ' +
|
||||
'style=' +
|
||||
'"width: ' +
|
||||
stepWidth +
|
||||
'px;"' +
|
||||
'>' +
|
||||
'</div>' +
|
||||
this.createMarker('relative', i) +
|
||||
/*render text every second step, except when only 2 steps */
|
||||
(i % 2 === 0 || this.scaleBarSteps_ === 2
|
||||
? this.createStepText(i, width, false, scale, suffix)
|
||||
: '') +
|
||||
'</div>');
|
||||
if (i === this.scaleBarSteps_ - 1) {
|
||||
{
|
||||
/*render text at the end */
|
||||
}
|
||||
scaleSteps.push(this.createStepText(i + 1, width, true, scale, suffix));
|
||||
}
|
||||
// switch style of steps
|
||||
backgroundColor =
|
||||
backgroundColor === 'ol-scale-singlebar-odd'
|
||||
? 'ol-scale-singlebar-even'
|
||||
: 'ol-scale-singlebar-odd';
|
||||
}
|
||||
var scaleBarText;
|
||||
if (this.scaleBarText_) {
|
||||
scaleBarText =
|
||||
'<div ' +
|
||||
'class="ol-scale-text" ' +
|
||||
'style="width: ' +
|
||||
width +
|
||||
'px;">' +
|
||||
mapScale +
|
||||
'</div>';
|
||||
}
|
||||
else {
|
||||
scaleBarText = '';
|
||||
}
|
||||
var container = '<div ' +
|
||||
'style="display: flex;">' +
|
||||
scaleBarText +
|
||||
scaleSteps.join('') +
|
||||
'</div>';
|
||||
return container;
|
||||
};
|
||||
/**
|
||||
* Creates a marker at given position
|
||||
* @param {string} position The position, absolute or relative
|
||||
* @param {number} i The iterator
|
||||
* @return {string} The stringified div containing the marker
|
||||
*/
|
||||
ScaleLine.prototype.createMarker = function (position, i) {
|
||||
var top = position === 'absolute' ? 3 : -10;
|
||||
return ('<div ' +
|
||||
'class="ol-scale-step-marker" ' +
|
||||
'style="position: ' +
|
||||
position +
|
||||
';' +
|
||||
'top: ' +
|
||||
top +
|
||||
'px;"' +
|
||||
'></div>');
|
||||
};
|
||||
/**
|
||||
* Creates the label for a marker marker at given position
|
||||
* @param {number} i The iterator
|
||||
* @param {number} width The width the scalebar will currently use
|
||||
* @param {boolean} isLast Flag indicating if we add the last step text
|
||||
* @param {number} scale The current scale for the whole scalebar
|
||||
* @param {string} suffix The suffix for the scale
|
||||
* @return {string} The stringified div containing the step text
|
||||
*/
|
||||
ScaleLine.prototype.createStepText = function (i, width, isLast, scale, suffix) {
|
||||
var length = i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;
|
||||
var lengthString = length + (i === 0 ? '' : ' ' + suffix);
|
||||
var margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;
|
||||
var minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;
|
||||
return ('<div ' +
|
||||
'class="ol-scale-step-text" ' +
|
||||
'style="' +
|
||||
'margin-left: ' +
|
||||
margin +
|
||||
'px;' +
|
||||
'text-align: ' +
|
||||
(i === 0 ? 'left' : 'center') +
|
||||
'; ' +
|
||||
'min-width: ' +
|
||||
minWidth +
|
||||
'px;' +
|
||||
'left: ' +
|
||||
(isLast ? width + 'px' : 'unset') +
|
||||
';"' +
|
||||
'>' +
|
||||
lengthString +
|
||||
'</div>');
|
||||
};
|
||||
/**
|
||||
* Returns the appropriate scale for the given resolution and units.
|
||||
* @return {number} The appropriate scale.
|
||||
*/
|
||||
ScaleLine.prototype.getScaleForResolution = function () {
|
||||
var resolution = getPointResolution(this.viewState_.projection, this.viewState_.resolution, this.viewState_.center, ProjUnits.METERS);
|
||||
var dpi = this.dpi_ || DEFAULT_DPI;
|
||||
var inchesPerMeter = 1000 / 25.4;
|
||||
return parseFloat(resolution.toString()) * inchesPerMeter * dpi;
|
||||
};
|
||||
/**
|
||||
* Update the scale line element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
ScaleLine.prototype.render = function (mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (!frameState) {
|
||||
this.viewState_ = null;
|
||||
}
|
||||
else {
|
||||
this.viewState_ = frameState.viewState;
|
||||
}
|
||||
this.updateElement_();
|
||||
};
|
||||
return ScaleLine;
|
||||
}(Control));
|
||||
export default ScaleLine;
|
||||
//# sourceMappingURL=ScaleLine.js.map
|
||||
1
node_modules/ol/control/ScaleLine.js.map
generated
vendored
Normal file
1
node_modules/ol/control/ScaleLine.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
94
node_modules/ol/control/Zoom.d.ts
generated
vendored
Normal file
94
node_modules/ol/control/Zoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
export default Zoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* CSS class name for the zoom-in button.
|
||||
*/
|
||||
zoomInClassName?: string | undefined;
|
||||
/**
|
||||
* CSS class name for the zoom-out button.
|
||||
*/
|
||||
zoomOutClassName?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the zoom-in
|
||||
* button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
zoomInLabel?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the zoom-out button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
zoomOutLabel?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
zoomInTipLabel?: string | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
zoomOutTipLabel?: string | undefined;
|
||||
/**
|
||||
* The zoom delta applied on each click.
|
||||
*/
|
||||
delta?: number | undefined;
|
||||
/**
|
||||
* Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {string} [className='ol-zoom'] CSS class name.
|
||||
* @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.
|
||||
* @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.
|
||||
* @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in
|
||||
* button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.
|
||||
* @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.
|
||||
* @property {number} [delta=1] The zoom delta applied on each click.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control with 2 buttons, one for zoom in and one for zoom out.
|
||||
* This control is one of the default controls of a map. To style this control
|
||||
* use css selectors `.ol-zoom-in` and `.ol-zoom-out`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Zoom extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Zoom options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @private
|
||||
*/
|
||||
private zoomByDelta_;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=Zoom.d.ts.map
|
||||
1
node_modules/ol/control/Zoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/Zoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Zoom.d.ts","sourceRoot":"","sources":["../src/control/Zoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,+CA+EC;IALC;;;OAGG;IACH,kBAAwE;IAG1E;;;;OAIG;IACH,qBAGC;IAED;;;OAGG;IACH,qBAwBC;CACF"}
|
||||
143
node_modules/ol/control/Zoom.js
generated
vendored
Normal file
143
node_modules/ol/control/Zoom.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/Zoom
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import { CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { easeOut } from '../easing.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {string} [className='ol-zoom'] CSS class name.
|
||||
* @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.
|
||||
* @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.
|
||||
* @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in
|
||||
* button. Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.
|
||||
* @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.
|
||||
* @property {number} [delta=1] The zoom delta applied on each click.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control to be
|
||||
* rendered outside of the map's viewport.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A control with 2 buttons, one for zoom in and one for zoom out.
|
||||
* This control is one of the default controls of a map. To style this control
|
||||
* use css selectors `.ol-zoom-in` and `.ol-zoom-out`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Zoom = /** @class */ (function (_super) {
|
||||
__extends(Zoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Zoom options.
|
||||
*/
|
||||
function Zoom(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
target: options.target,
|
||||
}) || this;
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoom';
|
||||
var delta = options.delta !== undefined ? options.delta : 1;
|
||||
var zoomInClassName = options.zoomInClassName !== undefined
|
||||
? options.zoomInClassName
|
||||
: className + '-in';
|
||||
var zoomOutClassName = options.zoomOutClassName !== undefined
|
||||
? options.zoomOutClassName
|
||||
: className + '-out';
|
||||
var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+';
|
||||
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2013';
|
||||
var zoomInTipLabel = options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';
|
||||
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined
|
||||
? options.zoomOutTipLabel
|
||||
: 'Zoom out';
|
||||
var inElement = document.createElement('button');
|
||||
inElement.className = zoomInClassName;
|
||||
inElement.setAttribute('type', 'button');
|
||||
inElement.title = zoomInTipLabel;
|
||||
inElement.appendChild(typeof zoomInLabel === 'string'
|
||||
? document.createTextNode(zoomInLabel)
|
||||
: zoomInLabel);
|
||||
inElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, delta), false);
|
||||
var outElement = document.createElement('button');
|
||||
outElement.className = zoomOutClassName;
|
||||
outElement.setAttribute('type', 'button');
|
||||
outElement.title = zoomOutTipLabel;
|
||||
outElement.appendChild(typeof zoomOutLabel === 'string'
|
||||
? document.createTextNode(zoomOutLabel)
|
||||
: zoomOutLabel);
|
||||
outElement.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this, -delta), false);
|
||||
var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
var element = _this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(inElement);
|
||||
element.appendChild(outElement);
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
Zoom.prototype.handleClick_ = function (delta, event) {
|
||||
event.preventDefault();
|
||||
this.zoomByDelta_(delta);
|
||||
};
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @private
|
||||
*/
|
||||
Zoom.prototype.zoomByDelta_ = function (delta) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
}
|
||||
var currentZoom = view.getZoom();
|
||||
if (currentZoom !== undefined) {
|
||||
var newZoom = view.getConstrainedZoom(currentZoom + delta);
|
||||
if (this.duration_ > 0) {
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
view.animate({
|
||||
zoom: newZoom,
|
||||
duration: this.duration_,
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
else {
|
||||
view.setZoom(newZoom);
|
||||
}
|
||||
}
|
||||
};
|
||||
return Zoom;
|
||||
}(Control));
|
||||
export default Zoom;
|
||||
//# sourceMappingURL=Zoom.js.map
|
||||
1
node_modules/ol/control/Zoom.js.map
generated
vendored
Normal file
1
node_modules/ol/control/Zoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Zoom.js","sourceRoot":"","sources":["../src/control/Zoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH;IAAmB,wBAAO;I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ol/control/ZoomSlider.d.ts
generated
vendored
Normal file
174
node_modules/ol/control/ZoomSlider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
export default ZoomSlider;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-zoomslider'] CSS class name.
|
||||
* @property {number} [duration=200] Animation duration in milliseconds.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A slider type of control for zooming.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* map.addControl(new ZoomSlider());
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class ZoomSlider extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Zoom slider options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
private dragListenerKeys_;
|
||||
/**
|
||||
* Will hold the current resolution of the view.
|
||||
*
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
private currentResolution_;
|
||||
/**
|
||||
* The direction of the slider. Will be determined from actual display of the
|
||||
* container and defaults to Direction.VERTICAL.
|
||||
*
|
||||
* @type {Direction}
|
||||
* @private
|
||||
*/
|
||||
private direction_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private dragging_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private heightLimit_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private widthLimit_;
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
private startX_;
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
private startY_;
|
||||
/**
|
||||
* The calculated thumb size (border box plus margins). Set when initSlider_
|
||||
* is called.
|
||||
* @type {import("../size.js").Size}
|
||||
* @private
|
||||
*/
|
||||
private thumbSize_;
|
||||
/**
|
||||
* Whether the slider is initialized.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private sliderInitialized_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* Initializes the slider element. This will determine and set this controls
|
||||
* direction_ and also constrain the dragging of the thumb to always be within
|
||||
* the bounds of the container.
|
||||
*
|
||||
* @return {boolean} Initialization successful
|
||||
* @private
|
||||
*/
|
||||
private initSlider_;
|
||||
/**
|
||||
* @param {PointerEvent} event The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
private handleContainerClick_;
|
||||
/**
|
||||
* Handle dragger start events.
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
private handleDraggerStart_;
|
||||
/**
|
||||
* Handle dragger drag events.
|
||||
*
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
private handleDraggerDrag_;
|
||||
/**
|
||||
* Handle dragger end events.
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
private handleDraggerEnd_;
|
||||
/**
|
||||
* Positions the thumb inside its container according to the given resolution.
|
||||
*
|
||||
* @param {number} res The res.
|
||||
* @private
|
||||
*/
|
||||
private setThumbPosition_;
|
||||
/**
|
||||
* Calculates the relative position of the thumb given x and y offsets. The
|
||||
* relative position scales from 0 to 1. The x and y offsets are assumed to be
|
||||
* in pixel units within the dragger limits.
|
||||
*
|
||||
* @param {number} x Pixel position relative to the left of the slider.
|
||||
* @param {number} y Pixel position relative to the top of the slider.
|
||||
* @return {number} The relative position of the thumb.
|
||||
* @private
|
||||
*/
|
||||
private getRelativePosition_;
|
||||
/**
|
||||
* Calculates the corresponding resolution of the thumb given its relative
|
||||
* position (where 0 is the minimum and 1 is the maximum).
|
||||
*
|
||||
* @param {number} position The relative position of the thumb.
|
||||
* @return {number} The corresponding resolution.
|
||||
* @private
|
||||
*/
|
||||
private getResolutionForPosition_;
|
||||
/**
|
||||
* Determines the relative position of the slider for the given resolution. A
|
||||
* relative position of 0 corresponds to the minimum view resolution. A
|
||||
* relative position of 1 corresponds to the maximum view resolution.
|
||||
*
|
||||
* @param {number} res The resolution.
|
||||
* @return {number} The relative position value (between 0 and 1).
|
||||
* @private
|
||||
*/
|
||||
private getPositionForResolution_;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=ZoomSlider.d.ts.map
|
||||
1
node_modules/ol/control/ZoomSlider.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/ZoomSlider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ZoomSlider.d.ts","sourceRoot":"","sources":["../src/control/ZoomSlider.js"],"names":[],"mappings":";;;;;;;;;;;;;;qBA2BuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;AAJ7D;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH;IACE;;OAEG;IACH,+CAkHC;IA1GC;;;OAGG;IACH,0BAA2B;IAE3B;;;;;OAKG;IACH,2BAAmC;IAEnC;;;;;;OAMG;IACH,mBAAoC;IAEpC;;;OAGG;IACH,kBAAc;IAEd;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,oBAAoB;IAEpB;;;OAGG;IACH,gBAAY;IAEZ;;;OAGG;IACH,gBAAY;IAEZ;;;;;OAKG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,2BAA+B;IAE/B;;;OAGG;IACH,kBAAwE;IAmD1E;;;;;;;OAOG;IACH,oBAmCC;IAED;;;OAGG;IACH,8BAgBC;IAED;;;;OAIG;IACH,4BAoBC;IAED;;;;;OAKG;IACH,2BASC;IAED;;;;OAIG;IACH,0BAWC;IAED;;;;;OAKG;IACH,0BASC;IAED;;;;;;;;;OASG;IACH,6BAQC;IAED;;;;;;;OAOG;IACH,kCAGC;IAED;;;;;;;;OAQG;IACH,kCAGC;CAkBF"}
|
||||
345
node_modules/ol/control/ZoomSlider.js
generated
vendored
Normal file
345
node_modules/ol/control/ZoomSlider.js
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
/**
|
||||
* @module ol/control/ZoomSlider
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import PointerEventType from '../pointer/EventType.js';
|
||||
import { CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { clamp } from '../math.js';
|
||||
import { easeOut } from '../easing.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
import { stopPropagation } from '../events/Event.js';
|
||||
/**
|
||||
* The enum for available directions.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
var Direction = {
|
||||
VERTICAL: 0,
|
||||
HORIZONTAL: 1,
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-zoomslider'] CSS class name.
|
||||
* @property {number} [duration=200] Animation duration in milliseconds.
|
||||
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
||||
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A slider type of control for zooming.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* map.addControl(new ZoomSlider());
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var ZoomSlider = /** @class */ (function (_super) {
|
||||
__extends(ZoomSlider, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Zoom slider options.
|
||||
*/
|
||||
function ZoomSlider(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
render: options.render,
|
||||
}) || this;
|
||||
/**
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
_this.dragListenerKeys_ = [];
|
||||
/**
|
||||
* Will hold the current resolution of the view.
|
||||
*
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
_this.currentResolution_ = undefined;
|
||||
/**
|
||||
* The direction of the slider. Will be determined from actual display of the
|
||||
* container and defaults to Direction.VERTICAL.
|
||||
*
|
||||
* @type {Direction}
|
||||
* @private
|
||||
*/
|
||||
_this.direction_ = Direction.VERTICAL;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.dragging_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.heightLimit_ = 0;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.widthLimit_ = 0;
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
_this.startX_;
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
_this.startY_;
|
||||
/**
|
||||
* The calculated thumb size (border box plus margins). Set when initSlider_
|
||||
* is called.
|
||||
* @type {import("../size.js").Size}
|
||||
* @private
|
||||
*/
|
||||
_this.thumbSize_ = null;
|
||||
/**
|
||||
* Whether the slider is initialized.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.sliderInitialized_ = false;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 200;
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoomslider';
|
||||
var thumbElement = document.createElement('button');
|
||||
thumbElement.setAttribute('type', 'button');
|
||||
thumbElement.className = className + '-thumb ' + CLASS_UNSELECTABLE;
|
||||
var containerElement = _this.element;
|
||||
containerElement.className =
|
||||
className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
containerElement.appendChild(thumbElement);
|
||||
containerElement.addEventListener(PointerEventType.POINTERDOWN, _this.handleDraggerStart_.bind(_this), false);
|
||||
containerElement.addEventListener(PointerEventType.POINTERMOVE, _this.handleDraggerDrag_.bind(_this), false);
|
||||
containerElement.addEventListener(PointerEventType.POINTERUP, _this.handleDraggerEnd_.bind(_this), false);
|
||||
containerElement.addEventListener(EventType.CLICK, _this.handleContainerClick_.bind(_this), false);
|
||||
thumbElement.addEventListener(EventType.CLICK, stopPropagation, false);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Remove the control from its current map and attach it to the new map.
|
||||
* Pass `null` to just remove the control from the current map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
ZoomSlider.prototype.setMap = function (map) {
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
map.render();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Initializes the slider element. This will determine and set this controls
|
||||
* direction_ and also constrain the dragging of the thumb to always be within
|
||||
* the bounds of the container.
|
||||
*
|
||||
* @return {boolean} Initialization successful
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.initSlider_ = function () {
|
||||
var container = this.element;
|
||||
var containerWidth = container.offsetWidth;
|
||||
var containerHeight = container.offsetHeight;
|
||||
if (containerWidth === 0 && containerHeight === 0) {
|
||||
return (this.sliderInitialized_ = false);
|
||||
}
|
||||
var containerStyle = getComputedStyle(container);
|
||||
containerWidth -=
|
||||
parseFloat(containerStyle['paddingRight']) +
|
||||
parseFloat(containerStyle['paddingLeft']);
|
||||
containerHeight -=
|
||||
parseFloat(containerStyle['paddingTop']) +
|
||||
parseFloat(containerStyle['paddingBottom']);
|
||||
var thumb = /** @type {HTMLElement} */ (container.firstElementChild);
|
||||
var thumbStyle = getComputedStyle(thumb);
|
||||
var thumbWidth = thumb.offsetWidth +
|
||||
parseFloat(thumbStyle['marginRight']) +
|
||||
parseFloat(thumbStyle['marginLeft']);
|
||||
var thumbHeight = thumb.offsetHeight +
|
||||
parseFloat(thumbStyle['marginTop']) +
|
||||
parseFloat(thumbStyle['marginBottom']);
|
||||
this.thumbSize_ = [thumbWidth, thumbHeight];
|
||||
if (containerWidth > containerHeight) {
|
||||
this.direction_ = Direction.HORIZONTAL;
|
||||
this.widthLimit_ = containerWidth - thumbWidth;
|
||||
}
|
||||
else {
|
||||
this.direction_ = Direction.VERTICAL;
|
||||
this.heightLimit_ = containerHeight - thumbHeight;
|
||||
}
|
||||
return (this.sliderInitialized_ = true);
|
||||
};
|
||||
/**
|
||||
* @param {PointerEvent} event The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.handleContainerClick_ = function (event) {
|
||||
var view = this.getMap().getView();
|
||||
var relativePosition = this.getRelativePosition_(event.offsetX - this.thumbSize_[0] / 2, event.offsetY - this.thumbSize_[1] / 2);
|
||||
var resolution = this.getResolutionForPosition_(relativePosition);
|
||||
var zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));
|
||||
view.animateInternal({
|
||||
zoom: zoom,
|
||||
duration: this.duration_,
|
||||
easing: easeOut,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Handle dragger start events.
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.handleDraggerStart_ = function (event) {
|
||||
if (!this.dragging_ && event.target === this.element.firstElementChild) {
|
||||
var element = /** @type {HTMLElement} */ (this.element.firstElementChild);
|
||||
this.getMap().getView().beginInteraction();
|
||||
this.startX_ = event.clientX - parseFloat(element.style.left);
|
||||
this.startY_ = event.clientY - parseFloat(element.style.top);
|
||||
this.dragging_ = true;
|
||||
if (this.dragListenerKeys_.length === 0) {
|
||||
var drag = this.handleDraggerDrag_;
|
||||
var end = this.handleDraggerEnd_;
|
||||
var doc = this.getMap().getOwnerDocument();
|
||||
this.dragListenerKeys_.push(listen(doc, PointerEventType.POINTERMOVE, drag, this), listen(doc, PointerEventType.POINTERUP, end, this));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle dragger drag events.
|
||||
*
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.handleDraggerDrag_ = function (event) {
|
||||
if (this.dragging_) {
|
||||
var deltaX = event.clientX - this.startX_;
|
||||
var deltaY = event.clientY - this.startY_;
|
||||
var relativePosition = this.getRelativePosition_(deltaX, deltaY);
|
||||
this.currentResolution_ =
|
||||
this.getResolutionForPosition_(relativePosition);
|
||||
this.getMap().getView().setResolution(this.currentResolution_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle dragger end events.
|
||||
* @param {PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.handleDraggerEnd_ = function (event) {
|
||||
if (this.dragging_) {
|
||||
var view = this.getMap().getView();
|
||||
view.endInteraction();
|
||||
this.dragging_ = false;
|
||||
this.startX_ = undefined;
|
||||
this.startY_ = undefined;
|
||||
this.dragListenerKeys_.forEach(unlistenByKey);
|
||||
this.dragListenerKeys_.length = 0;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Positions the thumb inside its container according to the given resolution.
|
||||
*
|
||||
* @param {number} res The res.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.setThumbPosition_ = function (res) {
|
||||
var position = this.getPositionForResolution_(res);
|
||||
var thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);
|
||||
if (this.direction_ == Direction.HORIZONTAL) {
|
||||
thumb.style.left = this.widthLimit_ * position + 'px';
|
||||
}
|
||||
else {
|
||||
thumb.style.top = this.heightLimit_ * position + 'px';
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Calculates the relative position of the thumb given x and y offsets. The
|
||||
* relative position scales from 0 to 1. The x and y offsets are assumed to be
|
||||
* in pixel units within the dragger limits.
|
||||
*
|
||||
* @param {number} x Pixel position relative to the left of the slider.
|
||||
* @param {number} y Pixel position relative to the top of the slider.
|
||||
* @return {number} The relative position of the thumb.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.getRelativePosition_ = function (x, y) {
|
||||
var amount;
|
||||
if (this.direction_ === Direction.HORIZONTAL) {
|
||||
amount = x / this.widthLimit_;
|
||||
}
|
||||
else {
|
||||
amount = y / this.heightLimit_;
|
||||
}
|
||||
return clamp(amount, 0, 1);
|
||||
};
|
||||
/**
|
||||
* Calculates the corresponding resolution of the thumb given its relative
|
||||
* position (where 0 is the minimum and 1 is the maximum).
|
||||
*
|
||||
* @param {number} position The relative position of the thumb.
|
||||
* @return {number} The corresponding resolution.
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.getResolutionForPosition_ = function (position) {
|
||||
var fn = this.getMap().getView().getResolutionForValueFunction();
|
||||
return fn(1 - position);
|
||||
};
|
||||
/**
|
||||
* Determines the relative position of the slider for the given resolution. A
|
||||
* relative position of 0 corresponds to the minimum view resolution. A
|
||||
* relative position of 1 corresponds to the maximum view resolution.
|
||||
*
|
||||
* @param {number} res The resolution.
|
||||
* @return {number} The relative position value (between 0 and 1).
|
||||
* @private
|
||||
*/
|
||||
ZoomSlider.prototype.getPositionForResolution_ = function (res) {
|
||||
var fn = this.getMap().getView().getValueForResolutionFunction();
|
||||
return clamp(1 - fn(res), 0, 1);
|
||||
};
|
||||
/**
|
||||
* Update the zoomslider element.
|
||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||
* @override
|
||||
*/
|
||||
ZoomSlider.prototype.render = function (mapEvent) {
|
||||
if (!mapEvent.frameState) {
|
||||
return;
|
||||
}
|
||||
if (!this.sliderInitialized_ && !this.initSlider_()) {
|
||||
return;
|
||||
}
|
||||
var res = mapEvent.frameState.viewState.resolution;
|
||||
this.currentResolution_ = res;
|
||||
this.setThumbPosition_(res);
|
||||
};
|
||||
return ZoomSlider;
|
||||
}(Control));
|
||||
export default ZoomSlider;
|
||||
//# sourceMappingURL=ZoomSlider.js.map
|
||||
1
node_modules/ol/control/ZoomSlider.js.map
generated
vendored
Normal file
1
node_modules/ol/control/ZoomSlider.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/ol/control/ZoomToExtent.d.ts
generated
vendored
Normal file
66
node_modules/ol/control/ZoomToExtent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
export default ZoomToExtent;
|
||||
export type Options = {
|
||||
/**
|
||||
* Class name.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
*/
|
||||
target?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
*/
|
||||
label?: string | HTMLElement | undefined;
|
||||
/**
|
||||
* Text label to use for the button tip.
|
||||
*/
|
||||
tipLabel?: string | undefined;
|
||||
/**
|
||||
* The extent to zoom to. If undefined the validity
|
||||
* extent of the view projection is used.
|
||||
*/
|
||||
extent?: import("../extent.js").Extent | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-zoom-extent'] Class name.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {string|HTMLElement} [label='E'] Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
|
||||
* @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
|
||||
* extent of the view projection is used.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control which, when pressed, changes the map view to a specific
|
||||
* extent. To style this control use the css selector `.ol-zoom-extent`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class ZoomToExtent extends Control {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {?import("../extent.js").Extent|null}
|
||||
* @protected
|
||||
*/
|
||||
protected extent: (import("../extent.js").Extent | null) | null;
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
private handleClick_;
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
protected handleZoomToExtent(): void;
|
||||
}
|
||||
import Control from "./Control.js";
|
||||
//# sourceMappingURL=ZoomToExtent.d.ts.map
|
||||
1
node_modules/ol/control/ZoomToExtent.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/control/ZoomToExtent.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ZoomToExtent.d.ts","sourceRoot":"","sources":["../src/control/ZoomToExtent.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,+CAsCC;IA9BC;;;OAGG;IACH,mBAHW,OAAO,cAAc,EAAE,MAAM,GAAC,IAAI,SAGO;IA4BtD;;;OAGG;IACH,qBAGC;IAED;;OAEG;IACH,qCAOC;CACF"}
|
||||
94
node_modules/ol/control/ZoomToExtent.js
generated
vendored
Normal file
94
node_modules/ol/control/ZoomToExtent.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/control/ZoomToExtent
|
||||
*/
|
||||
import Control from './Control.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import { CLASS_CONTROL, CLASS_UNSELECTABLE } from '../css.js';
|
||||
import { fromExtent as polygonFromExtent } from '../geom/Polygon.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-zoom-extent'] Class name.
|
||||
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
||||
* to be rendered outside of the map's viewport.
|
||||
* @property {string|HTMLElement} [label='E'] Text label to use for the button.
|
||||
* Instead of text, also an element (e.g. a `span` element) can be used.
|
||||
* @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
|
||||
* @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
|
||||
* extent of the view projection is used.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* A button control which, when pressed, changes the map view to a specific
|
||||
* extent. To style this control use the css selector `.ol-zoom-extent`.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var ZoomToExtent = /** @class */ (function (_super) {
|
||||
__extends(ZoomToExtent, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function ZoomToExtent(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
element: document.createElement('div'),
|
||||
target: options.target,
|
||||
}) || this;
|
||||
/**
|
||||
* @type {?import("../extent.js").Extent|null}
|
||||
* @protected
|
||||
*/
|
||||
_this.extent = options.extent ? options.extent : null;
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoom-extent';
|
||||
var label = options.label !== undefined ? options.label : 'E';
|
||||
var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.title = tipLabel;
|
||||
button.appendChild(typeof label === 'string' ? document.createTextNode(label) : label);
|
||||
button.addEventListener(EventType.CLICK, _this.handleClick_.bind(_this), false);
|
||||
var cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
|
||||
var element = _this.element;
|
||||
element.className = cssClasses;
|
||||
element.appendChild(button);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {MouseEvent} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ZoomToExtent.prototype.handleClick_ = function (event) {
|
||||
event.preventDefault();
|
||||
this.handleZoomToExtent();
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ZoomToExtent.prototype.handleZoomToExtent = function () {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var extent = !this.extent
|
||||
? view.getProjection().getExtent()
|
||||
: this.extent;
|
||||
view.fitInternal(polygonFromExtent(extent));
|
||||
};
|
||||
return ZoomToExtent;
|
||||
}(Control));
|
||||
export default ZoomToExtent;
|
||||
//# sourceMappingURL=ZoomToExtent.js.map
|
||||
1
node_modules/ol/control/ZoomToExtent.js.map
generated
vendored
Normal file
1
node_modules/ol/control/ZoomToExtent.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ZoomToExtent.js","sourceRoot":"","sources":["../src/control/ZoomToExtent.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAC,UAAU,IAAI,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAEnE;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH;IAA2B,gCAAO;IAChC;;OAEG;IACH,sBAAY,WAAW;QAAvB,iBAsCC;QArCC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBAE/C,kBAAM;YACJ,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;YACtC,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QAEF;;;WAGG;QACH,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAErD,IAAM,SAAS,GACb,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAEzE,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;QAChE,IAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC;QACtE,IAAM,MAAM,GAAG,QAAQ,CAAC,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