|undefined} The resolutions of the view.
+ * @api
*/
- Interaction.prototype.setMap = function setMap (map) {
- this.map_ = map;
+ View.prototype.getResolutions = function getResolutions () {
+ return this.resolutions_;
};
- return Interaction;
+ /**
+ * Get the resolution for a provided extent (in map units) and size (in pixels).
+ * @param {import("./extent.js").Extent} extent Extent.
+ * @param {import("./size.js").Size=} opt_size Box pixel size.
+ * @return {number} The resolution at which the provided extent will render at
+ * the given size.
+ * @api
+ */
+ View.prototype.getResolutionForExtent = function getResolutionForExtent (extent, opt_size) {
+ var size = opt_size || this.getSizeFromViewport_();
+ var xResolution = Object(ol_extent["E" /* getWidth */])(extent) / size[0];
+ var yResolution = Object(ol_extent["A" /* getHeight */])(extent) / size[1];
+ return Math.max(xResolution, yResolution);
+ };
+
+ /**
+ * Return a function that returns a value between 0 and 1 for a
+ * resolution. Exponential scaling is assumed.
+ * @param {number=} opt_power Power.
+ * @return {function(number): number} Resolution for value function.
+ */
+ View.prototype.getResolutionForValueFunction = function getResolutionForValueFunction (opt_power) {
+ var power = opt_power || 2;
+ var maxResolution = this.maxResolution_;
+ var minResolution = this.minResolution_;
+ var max = Math.log(maxResolution / minResolution) / Math.log(power);
+ return (
+ /**
+ * @param {number} value Value.
+ * @return {number} Resolution.
+ */
+ function(value) {
+ var resolution = maxResolution / Math.pow(power, value * max);
+ return resolution;
+ });
+ };
+
+ /**
+ * Get the view rotation.
+ * @return {number} The rotation of the view in radians.
+ * @observable
+ * @api
+ */
+ View.prototype.getRotation = function getRotation () {
+ return /** @type {number} */ (this.get(ViewProperty.ROTATION));
+ };
+
+ /**
+ * Return a function that returns a resolution for a value between
+ * 0 and 1. Exponential scaling is assumed.
+ * @param {number=} opt_power Power.
+ * @return {function(number): number} Value for resolution function.
+ */
+ View.prototype.getValueForResolutionFunction = function getValueForResolutionFunction (opt_power) {
+ var power = opt_power || 2;
+ var maxResolution = this.maxResolution_;
+ var minResolution = this.minResolution_;
+ var max = Math.log(maxResolution / minResolution) / Math.log(power);
+ return (
+ /**
+ * @param {number} resolution Resolution.
+ * @return {number} Value.
+ */
+ function(resolution) {
+ var value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;
+ return value;
+ });
+ };
+
+ /**
+ * @param {number} pixelRatio Pixel ratio for center rounding.
+ * @return {State} View state.
+ */
+ View.prototype.getState = function getState (pixelRatio) {
+ var center = /** @type {import("./coordinate.js").Coordinate} */ (this.getCenter());
+ var projection = this.getProjection();
+ var resolution = /** @type {number} */ (this.getResolution());
+ var pixelResolution = resolution / pixelRatio;
+ var rotation = this.getRotation();
+ return (
+ /** @type {State} */ ({
+ center: [
+ Math.round(center[0] / pixelResolution) * pixelResolution,
+ Math.round(center[1] / pixelResolution) * pixelResolution
+ ],
+ projection: projection !== undefined ? projection : null,
+ resolution: resolution,
+ rotation: rotation,
+ zoom: this.getZoom()
+ })
+ );
+ };
+
+ /**
+ * Get the current zoom level. If you configured your view with a resolutions
+ * array (this is rare), this method may return non-integer zoom levels (so
+ * the zoom level is not safe to use as an index into a resolutions array).
+ * @return {number|undefined} Zoom.
+ * @api
+ */
+ View.prototype.getZoom = function getZoom () {
+ var zoom;
+ var resolution = this.getResolution();
+ if (resolution !== undefined) {
+ zoom = this.getZoomForResolution(resolution);
+ }
+ return zoom;
+ };
+
+ /**
+ * Get the zoom level for a resolution.
+ * @param {number} resolution The resolution.
+ * @return {number|undefined} The zoom level for the provided resolution.
+ * @api
+ */
+ View.prototype.getZoomForResolution = function getZoomForResolution (resolution) {
+ var offset = this.minZoom_ || 0;
+ var max, zoomFactor;
+ if (this.resolutions_) {
+ var nearest = Object(array["f" /* linearFindNearest */])(this.resolutions_, resolution, 1);
+ offset = nearest;
+ max = this.resolutions_[nearest];
+ if (nearest == this.resolutions_.length - 1) {
+ zoomFactor = 2;
+ } else {
+ zoomFactor = max / this.resolutions_[nearest + 1];
+ }
+ } else {
+ max = this.maxResolution_;
+ zoomFactor = this.zoomFactor_;
+ }
+ return offset + Math.log(max / resolution) / Math.log(zoomFactor);
+ };
+
+ /**
+ * Get the resolution for a zoom level.
+ * @param {number} zoom Zoom level.
+ * @return {number} The view resolution for the provided zoom level.
+ * @api
+ */
+ View.prototype.getResolutionForZoom = function getResolutionForZoom (zoom) {
+ return /** @type {number} */ (this.constrainResolution(
+ this.maxResolution_, zoom - this.minZoom_, 0));
+ };
+
+ /**
+ * Fit the given geometry or extent based on the given map size and border.
+ * The size is pixel dimensions of the box to fit the extent into.
+ * In most cases you will want to use the map size, that is `map.getSize()`.
+ * Takes care of the map angle.
+ * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
+ * extent to fit the view to.
+ * @param {FitOptions=} opt_options Options.
+ * @api
+ */
+ View.prototype.fit = function fit (geometryOrExtent, opt_options) {
+ var options = opt_options || {};
+ var size = options.size;
+ if (!size) {
+ size = this.getSizeFromViewport_();
+ }
+ /** @type {import("./geom/SimpleGeometry.js").default} */
+ var geometry;
+ Object(asserts["a" /* assert */])(Array.isArray(geometryOrExtent) || typeof /** @type {?} */ (geometryOrExtent).getSimplifiedGeometry === 'function',
+ 24); // Invalid extent or geometry provided as `geometry`
+ if (Array.isArray(geometryOrExtent)) {
+ Object(asserts["a" /* assert */])(!Object(ol_extent["H" /* isEmpty */])(geometryOrExtent),
+ 25); // Cannot fit empty extent provided as `geometry`
+ geometry = Object(Polygon["b" /* fromExtent */])(geometryOrExtent);
+ } else if (geometryOrExtent.getType() === GeometryType["a" /* default */].CIRCLE) {
+ geometryOrExtent = geometryOrExtent.getExtent();
+ geometry = Object(Polygon["b" /* fromExtent */])(geometryOrExtent);
+ geometry.rotate(this.getRotation(), Object(ol_extent["x" /* getCenter */])(geometryOrExtent));
+ } else {
+ geometry = geometryOrExtent;
+ }
+
+ var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
+ var constrainResolution = options.constrainResolution !== undefined ?
+ options.constrainResolution : true;
+ var nearest = options.nearest !== undefined ? options.nearest : false;
+ var minResolution;
+ if (options.minResolution !== undefined) {
+ minResolution = options.minResolution;
+ } else if (options.maxZoom !== undefined) {
+ minResolution = this.constrainResolution(
+ this.maxResolution_, options.maxZoom - this.minZoom_, 0);
+ } else {
+ minResolution = 0;
+ }
+ var coords = geometry.getFlatCoordinates();
+
+ // calculate rotated extent
+ var rotation = this.getRotation();
+ var cosAngle = Math.cos(-rotation);
+ var sinAngle = Math.sin(-rotation);
+ var minRotX = +Infinity;
+ var minRotY = +Infinity;
+ var maxRotX = -Infinity;
+ var maxRotY = -Infinity;
+ var stride = geometry.getStride();
+ for (var i = 0, ii = coords.length; i < ii; i += stride) {
+ var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;
+ var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;
+ minRotX = Math.min(minRotX, rotX);
+ minRotY = Math.min(minRotY, rotY);
+ maxRotX = Math.max(maxRotX, rotX);
+ maxRotY = Math.max(maxRotY, rotY);
+ }
+
+ // calculate resolution
+ var resolution = this.getResolutionForExtent(
+ [minRotX, minRotY, maxRotX, maxRotY],
+ [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]);
+ resolution = isNaN(resolution) ? minResolution :
+ Math.max(resolution, minResolution);
+ if (constrainResolution) {
+ var constrainedResolution = this.constrainResolution(resolution, 0, 0);
+ if (!nearest && constrainedResolution < resolution) {
+ constrainedResolution = this.constrainResolution(
+ constrainedResolution, -1, 0);
+ }
+ resolution = constrainedResolution;
+ }
+
+ // calculate center
+ sinAngle = -sinAngle; // go back to original rotation
+ var centerRotX = (minRotX + maxRotX) / 2;
+ var centerRotY = (minRotY + maxRotY) / 2;
+ centerRotX += (padding[1] - padding[3]) / 2 * resolution;
+ centerRotY += (padding[0] - padding[2]) / 2 * resolution;
+ var centerX = centerRotX * cosAngle - centerRotY * sinAngle;
+ var centerY = centerRotY * cosAngle + centerRotX * sinAngle;
+ var center = [centerX, centerY];
+ var callback = options.callback ? options.callback : functions["c" /* VOID */];
+
+ if (options.duration !== undefined) {
+ this.animate({
+ resolution: resolution,
+ center: center,
+ duration: options.duration,
+ easing: options.easing
+ }, callback);
+ } else {
+ this.setResolution(resolution);
+ this.setCenter(center);
+ animationCallback(callback, true);
+ }
+ };
+
+ /**
+ * Center on coordinate and view position.
+ * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
+ * @param {import("./size.js").Size} size Box pixel size.
+ * @param {import("./pixel.js").Pixel} position Position on the view to center on.
+ * @api
+ */
+ View.prototype.centerOn = function centerOn (coordinate, size, position) {
+ // calculate rotated position
+ var rotation = this.getRotation();
+ var cosAngle = Math.cos(-rotation);
+ var sinAngle = Math.sin(-rotation);
+ var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
+ var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;
+ var resolution = this.getResolution();
+ rotX += (size[0] / 2 - position[0]) * resolution;
+ rotY += (position[1] - size[1] / 2) * resolution;
+
+ // go back to original angle
+ sinAngle = -sinAngle; // go back to original rotation
+ var centerX = rotX * cosAngle - rotY * sinAngle;
+ var centerY = rotY * cosAngle + rotX * sinAngle;
+
+ this.setCenter([centerX, centerY]);
+ };
+
+ /**
+ * @return {boolean} Is defined.
+ */
+ View.prototype.isDef = function isDef () {
+ return !!this.getCenter() && this.getResolution() !== undefined;
+ };
+
+ /**
+ * Rotate the view around a given coordinate.
+ * @param {number} rotation New rotation value for the view.
+ * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center.
+ * @api
+ */
+ View.prototype.rotate = function rotate (rotation, opt_anchor) {
+ if (opt_anchor !== undefined) {
+ var center = this.calculateCenterRotate(rotation, opt_anchor);
+ this.setCenter(center);
+ }
+ this.setRotation(rotation);
+ };
+
+ /**
+ * Set the center of the current view.
+ * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
+ * @observable
+ * @api
+ */
+ View.prototype.setCenter = function setCenter (center) {
+ this.set(ViewProperty.CENTER, center);
+ if (this.getAnimating()) {
+ this.cancelAnimations();
+ }
+ };
+
+ /**
+ * @param {ViewHint} hint Hint.
+ * @param {number} delta Delta.
+ * @return {number} New value.
+ */
+ View.prototype.setHint = function setHint (hint, delta) {
+ this.hints_[hint] += delta;
+ this.changed();
+ return this.hints_[hint];
+ };
+
+ /**
+ * Set the resolution for this view.
+ * @param {number|undefined} resolution The resolution of the view.
+ * @observable
+ * @api
+ */
+ View.prototype.setResolution = function setResolution (resolution) {
+ this.set(ViewProperty.RESOLUTION, resolution);
+ if (this.getAnimating()) {
+ this.cancelAnimations();
+ }
+ };
+
+ /**
+ * Set the rotation for this view.
+ * @param {number} rotation The rotation of the view in radians.
+ * @observable
+ * @api
+ */
+ View.prototype.setRotation = function setRotation (rotation) {
+ this.set(ViewProperty.ROTATION, rotation);
+ if (this.getAnimating()) {
+ this.cancelAnimations();
+ }
+ };
+
+ /**
+ * Zoom to a specific zoom level.
+ * @param {number} zoom Zoom level.
+ * @api
+ */
+ View.prototype.setZoom = function setZoom (zoom) {
+ this.setResolution(this.getResolutionForZoom(zoom));
+ };
+
+ return View;
}(ol_Object["a" /* default */]));
/**
- * @param {import("../View.js").default} view View.
- * @param {import("../coordinate.js").Coordinate} delta Delta.
- * @param {number=} opt_duration Duration.
+ * @param {Function} callback Callback.
+ * @param {*} returnValue Return value.
*/
-function pan(view, delta, opt_duration) {
- var currentCenter = view.getCenter();
- if (currentCenter) {
- var center = view.constrainCenter(
- [currentCenter[0] + delta[0], currentCenter[1] + delta[1]]);
- if (opt_duration) {
- view.animate({
- duration: opt_duration,
- easing: easing["d" /* linear */],
- center: center
- });
+function animationCallback(callback, returnValue) {
+ setTimeout(function() {
+ callback(returnValue);
+ }, 0);
+}
+
+
+/**
+ * @param {ViewOptions} options View options.
+ * @return {import("./centerconstraint.js").Type} The constraint.
+ */
+function createCenterConstraint(options) {
+ if (options.extent !== undefined) {
+ return createExtent(options.extent);
+ } else {
+ return none;
+ }
+}
+
+
+/**
+ * @param {ViewOptions} options View options.
+ * @return {{constraint: import("./resolutionconstraint.js").Type, maxResolution: number,
+ * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.
+ */
+function createResolutionConstraint(options) {
+ var resolutionConstraint;
+ var maxResolution;
+ var minResolution;
+
+ // TODO: move these to be ol constants
+ // see https://github.com/openlayers/openlayers/issues/2076
+ var defaultMaxZoom = 28;
+ var defaultZoomFactor = 2;
+
+ var minZoom = options.minZoom !== undefined ?
+ options.minZoom : DEFAULT_MIN_ZOOM;
+
+ var maxZoom = options.maxZoom !== undefined ?
+ options.maxZoom : defaultMaxZoom;
+
+ var zoomFactor = options.zoomFactor !== undefined ?
+ options.zoomFactor : defaultZoomFactor;
+
+ if (options.resolutions !== undefined) {
+ var resolutions = options.resolutions;
+ maxResolution = resolutions[minZoom];
+ minResolution = resolutions[maxZoom] !== undefined ?
+ resolutions[maxZoom] : resolutions[resolutions.length - 1];
+ resolutionConstraint = createSnapToResolutions(
+ resolutions);
+ } else {
+ // calculate the default min and max resolution
+ var projection = Object(proj["b" /* createProjection */])(options.projection, 'EPSG:3857');
+ var extent = projection.getExtent();
+ var size = !extent ?
+ // use an extent that can fit the whole world if need be
+ 360 * proj["a" /* METERS_PER_UNIT */][Units["b" /* default */].DEGREES] /
+ projection.getMetersPerUnit() :
+ Math.max(Object(ol_extent["E" /* getWidth */])(extent), Object(ol_extent["A" /* getHeight */])(extent));
+
+ var defaultMaxResolution = size / common["b" /* DEFAULT_TILE_SIZE */] / Math.pow(
+ defaultZoomFactor, DEFAULT_MIN_ZOOM);
+
+ var defaultMinResolution = defaultMaxResolution / Math.pow(
+ defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);
+
+ // user provided maxResolution takes precedence
+ maxResolution = options.maxResolution;
+ if (maxResolution !== undefined) {
+ minZoom = 0;
} else {
- view.setCenter(center);
- }
- }
-}
-
-
-/**
- * @param {import("../View.js").default} view View.
- * @param {number|undefined} rotation Rotation.
- * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
- * @param {number=} opt_duration Duration.
- */
-function rotate(view, rotation, opt_anchor, opt_duration) {
- rotation = view.constrainRotation(rotation, 0);
- rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration);
-}
-
-
-/**
- * @param {import("../View.js").default} view View.
- * @param {number|undefined} rotation Rotation.
- * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
- * @param {number=} opt_duration Duration.
- */
-function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration) {
- if (rotation !== undefined) {
- var currentRotation = view.getRotation();
- var currentCenter = view.getCenter();
- if (currentRotation !== undefined && currentCenter && opt_duration > 0) {
- view.animate({
- rotation: rotation,
- anchor: opt_anchor,
- duration: opt_duration,
- easing: easing["b" /* easeOut */]
- });
- } else {
- view.rotate(rotation, opt_anchor);
- }
- }
-}
-
-
-/**
- * @param {import("../View.js").default} view View.
- * @param {number|undefined} resolution Resolution to go to.
- * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
- * @param {number=} opt_duration Duration.
- * @param {number=} opt_direction Zooming direction; > 0 indicates
- * zooming out, in which case the constraints system will select
- * the largest nearest resolution; < 0 indicates zooming in, in
- * which case the constraints system will select the smallest
- * nearest resolution; == 0 indicates that the zooming direction
- * is unknown/not relevant, in which case the constraints system
- * will select the nearest resolution. If not defined 0 is
- * assumed.
- */
-function zoom(view, resolution, opt_anchor, opt_duration, opt_direction) {
- resolution = view.constrainResolution(resolution, 0, opt_direction);
- zoomWithoutConstraints(view, resolution, opt_anchor, opt_duration);
-}
-
-
-/**
- * @param {import("../View.js").default} view View.
- * @param {number} delta Delta from previous zoom level.
- * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
- * @param {number=} opt_duration Duration.
- */
-function zoomByDelta(view, delta, opt_anchor, opt_duration) {
- var currentResolution = view.getResolution();
- var resolution = view.constrainResolution(currentResolution, delta, 0);
-
- if (resolution !== undefined) {
- var resolutions = view.getResolutions();
- resolution = Object(math["a" /* clamp */])(
- resolution,
- view.getMinResolution() || resolutions[resolutions.length - 1],
- view.getMaxResolution() || resolutions[0]);
- }
-
- // If we have a constraint on center, we need to change the anchor so that the
- // new center is within the extent. We first calculate the new center, apply
- // the constraint to it, and then calculate back the anchor
- if (opt_anchor && resolution !== undefined && resolution !== currentResolution) {
- var currentCenter = view.getCenter();
- var center = view.calculateCenterZoom(resolution, opt_anchor);
- center = view.constrainCenter(center);
-
- opt_anchor = [
- (resolution * currentCenter[0] - currentResolution * center[0]) /
- (resolution - currentResolution),
- (resolution * currentCenter[1] - currentResolution * center[1]) /
- (resolution - currentResolution)
- ];
- }
-
- zoomWithoutConstraints(view, resolution, opt_anchor, opt_duration);
-}
-
-
-/**
- * @param {import("../View.js").default} view View.
- * @param {number|undefined} resolution Resolution to go to.
- * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate.
- * @param {number=} opt_duration Duration.
- */
-function zoomWithoutConstraints(view, resolution, opt_anchor, opt_duration) {
- if (resolution) {
- var currentResolution = view.getResolution();
- var currentCenter = view.getCenter();
- if (currentResolution !== undefined && currentCenter &&
- resolution !== currentResolution && opt_duration) {
- view.animate({
- resolution: resolution,
- anchor: opt_anchor,
- duration: opt_duration,
- easing: easing["b" /* easeOut */]
- });
- } else {
- if (opt_anchor) {
- var center = view.calculateCenterZoom(resolution, opt_anchor);
- view.setCenter(center);
- }
- view.setResolution(resolution);
- }
- }
-}
-
-/* harmony default export */ var interaction_Interaction = (Interaction_Interaction);
-
-//# sourceMappingURL=Interaction.js.map
-// CONCATENATED MODULE: ./node_modules/ol/interaction/DoubleClickZoom.js
-/**
- * @module ol/interaction/DoubleClickZoom
- */
-
-
-
-
-/**
- * @typedef {Object} Options
- * @property {number} [duration=250] Animation duration in milliseconds.
- * @property {number} [delta=1] The zoom delta applied on each double click.
- */
-
-
-/**
- * @classdesc
- * Allows the user to zoom by double-clicking on the map.
- * @api
- */
-var DoubleClickZoom = /*@__PURE__*/(function (Interaction) {
- function DoubleClickZoom(opt_options) {
- Interaction.call(this, {
- handleEvent: DoubleClickZoom_handleEvent
- });
-
- var options = opt_options ? opt_options : {};
-
- /**
- * @private
- * @type {number}
- */
- this.delta_ = options.delta ? options.delta : 1;
-
- /**
- * @private
- * @type {number}
- */
- this.duration_ = options.duration !== undefined ? options.duration : 250;
-
- }
-
- if ( Interaction ) DoubleClickZoom.__proto__ = Interaction;
- DoubleClickZoom.prototype = Object.create( Interaction && Interaction.prototype );
- DoubleClickZoom.prototype.constructor = DoubleClickZoom;
-
- return DoubleClickZoom;
-}(interaction_Interaction));
-
-
-/**
- * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
- * doubleclick) and eventually zooms the map.
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} `false` to stop event propagation.
- * @this {DoubleClickZoom}
- */
-function DoubleClickZoom_handleEvent(mapBrowserEvent) {
- var stopEvent = false;
- if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
- var browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
- var map = mapBrowserEvent.map;
- var anchor = mapBrowserEvent.coordinate;
- var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
- var view = map.getView();
- zoomByDelta(view, delta, anchor, this.duration_);
- mapBrowserEvent.preventDefault();
- stopEvent = true;
- }
- return !stopEvent;
-}
-
-/* harmony default export */ var interaction_DoubleClickZoom = (DoubleClickZoom);
-
-//# sourceMappingURL=DoubleClickZoom.js.map
-// EXTERNAL MODULE: ./node_modules/ol/coordinate.js + 1 modules
-var ol_coordinate = __webpack_require__(39);
-
-// CONCATENATED MODULE: ./node_modules/ol/events/condition.js
-/**
- * @module ol/events/condition
- */
-
-
-
-
-
-
-/**
- * A function that takes an {@link module:ol/MapBrowserEvent} and returns a
- * `{boolean}`. If the condition is met, true should be returned.
- *
- * @typedef {function(this: ?, import("../MapBrowserEvent.js").default): boolean} Condition
- */
-
-
-/**
- * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
- * additionally the shift-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the alt key is pressed.
- * @api
- */
-var altKeyOnly = function(mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (
- originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- !originalEvent.shiftKey);
-};
-
-
-/**
- * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise
- * (e.g. when additionally the platform-modifier-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the alt and shift keys are pressed.
- * @api
- */
-var altShiftKeysOnly = function(mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (
- originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- originalEvent.shiftKey);
-};
-
-
-/**
- * Return `true` if the map has the focus. This condition requires a map target
- * element with a `tabindex` attribute, e.g. ``.
- *
- * @param {import("../MapBrowserEvent.js").default} event Map browser event.
- * @return {boolean} The map has the focus.
- * @api
- */
-var condition_focus = function(event) {
- return event.target.getTargetElement() === document.activeElement;
-};
-
-
-/**
- * Return always true.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True.
- * @api
- */
-var always = functions["b" /* TRUE */];
-
-
-/**
- * Return `true` if the event is a `click` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `click` event.
- * @api
- */
-var click = function(mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.CLICK;
-};
-
-
-/**
- * Return `true` if the event has an "action"-producing mouse button.
- *
- * By definition, this includes left-click on windows/linux, and left-click
- * without the ctrl key on Macs.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} The result.
- */
-var mouseActionButton = function(mapBrowserEvent) {
- var originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
- return originalEvent.button == 0 &&
- !(has["i" /* WEBKIT */] && has["d" /* MAC */] && originalEvent.ctrlKey);
-};
-
-
-/**
- * Return always false.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} False.
- * @api
- */
-var never = functions["a" /* FALSE */];
-
-
-/**
- * Return `true` if the browser event is a `pointermove` event, `false`
- * otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the browser event is a `pointermove` event.
- * @api
- */
-var condition_pointerMove = function(mapBrowserEvent) {
- return mapBrowserEvent.type == 'pointermove';
-};
-
-
-/**
- * Return `true` if the event is a map `singleclick` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `singleclick` event.
- * @api
- */
-var singleClick = function(mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;
-};
-
-
-/**
- * Return `true` if the event is a map `dblclick` event, `false` otherwise.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if the event is a map `dblclick` event.
- * @api
- */
-var doubleClick = function(mapBrowserEvent) {
- return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;
-};
-
-
-/**
- * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is
- * pressed.
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True only if there no modifier keys are pressed.
- * @api
- */
-var noModifierKeys = function(mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (
- !originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- !originalEvent.shiftKey);
-};
-
-
-/**
- * Return `true` if only the platform-modifier-key (the meta-key on Mac,
- * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally
- * the shift-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the platform modifier key is pressed.
- * @api
- */
-var platformModifierKeyOnly = function(mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return !originalEvent.altKey &&
- (has["d" /* MAC */] ? originalEvent.metaKey : originalEvent.ctrlKey) &&
- !originalEvent.shiftKey;
-};
-
-
-/**
- * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when
- * additionally the alt-key is pressed).
- *
- * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
- * @return {boolean} True if only the shift key is pressed.
- * @api
- */
-var shiftKeyOnly = function(mapBrowserEvent) {
- var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
- return (
- !originalEvent.altKey &&
- !(originalEvent.metaKey || originalEvent.ctrlKey) &&
- originalEvent.shiftKey);
-};
-
-
-/**
- * Return `true` if the target element is not editable, i.e. not a ``-,
- * `