This commit is contained in:
39
node_modules/ol/interaction/DoubleClickZoom.d.ts
generated
vendored
Normal file
39
node_modules/ol/interaction/DoubleClickZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
export default DoubleClickZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* The zoom delta applied on each double click.
|
||||
*/
|
||||
delta?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
declare class DoubleClickZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private delta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=DoubleClickZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/DoubleClickZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DoubleClickZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DoubleClickZoom.d.ts","sourceRoot":"","sources":["../src/interaction/DoubleClickZoom.js"],"names":[],"mappings":";;;;;;;;;;;AAMA;;;;GAIG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CAgBC;IAXC;;;OAGG;IACH,eAA+C;IAE/C;;;OAGG;IACH,kBAAwE;CAyB3E"}
|
||||
74
node_modules/ol/interaction/DoubleClickZoom.js
generated
vendored
Normal file
74
node_modules/ol/interaction/DoubleClickZoom.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
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/interaction/DoubleClickZoom
|
||||
*/
|
||||
import Interaction, { zoomByDelta } from './Interaction.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
/**
|
||||
* @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 = /** @class */ (function (_super) {
|
||||
__extends(DoubleClickZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DoubleClickZoom(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
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;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~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.
|
||||
*/
|
||||
DoubleClickZoom.prototype.handleEvent = function (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_);
|
||||
browserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
return DoubleClickZoom;
|
||||
}(Interaction));
|
||||
export default DoubleClickZoom;
|
||||
//# sourceMappingURL=DoubleClickZoom.js.map
|
||||
1
node_modules/ol/interaction/DoubleClickZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DoubleClickZoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DoubleClickZoom.js","sourceRoot":"","sources":["../src/interaction/DoubleClickZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,WAAW,EAAE,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAE5D;;;;GAIG;AAEH;;;;GAIG;AACH;IAA8B,mCAAW;IACvC;;OAEG;IACH,yBAAY,WAAW;QAAvB,YACE,iBAAO,SAeR;QAbC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/C;;;WAGG;QACH,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;;IAC3E,CAAC;IAED;;;;;OAKG;IACH,qCAAW,GAAX,UAAY,eAAe;QACzB,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,eAAe,CAAC,IAAI,IAAI,mBAAmB,CAAC,QAAQ,EAAE;YACxD,IAAM,YAAY,GAAG,yBAAyB,CAAC,CAC7C,eAAe,CAAC,aAAa,CAC9B,CAAC;YACF,IAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;YAChC,IAAM,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC;YAC1C,IAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YACjE,IAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAC3B,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACjD,YAAY,CAAC,cAAc,EAAE,CAAC;YAC9B,SAAS,GAAG,IAAI,CAAC;SAClB;QACD,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC;IACH,sBAAC;AAAD,CAAC,AA5CD,CAA8B,WAAW,GA4CxC;AAED,eAAe,eAAe,CAAC"}
|
||||
173
node_modules/ol/interaction/DragAndDrop.d.ts
generated
vendored
Normal file
173
node_modules/ol/interaction/DragAndDrop.d.ts
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances
|
||||
* of this type.
|
||||
*/
|
||||
export class DragAndDropEvent extends Event {
|
||||
/**
|
||||
* @param {DragAndDropEventType} type Type.
|
||||
* @param {File} file File.
|
||||
* @param {Array<import("../Feature.js").default>} [opt_features] Features.
|
||||
* @param {import("../proj/Projection.js").default} [opt_projection] Projection.
|
||||
*/
|
||||
constructor(type: DragAndDropEventType, file: File, opt_features?: import("../Feature.js").default<import("../geom/Geometry.js").default>[] | undefined, opt_projection?: import("../proj/Projection.js").default | undefined);
|
||||
/**
|
||||
* The features parsed from dropped data.
|
||||
* @type {Array<import("../Feature.js").FeatureLike>|undefined}
|
||||
* @api
|
||||
*/
|
||||
features: Array<import("../Feature.js").FeatureLike> | undefined;
|
||||
/**
|
||||
* The dropped file.
|
||||
* @type {File}
|
||||
* @api
|
||||
*/
|
||||
file: File;
|
||||
/**
|
||||
* The feature projection.
|
||||
* @type {import("../proj/Projection.js").default|undefined}
|
||||
* @api
|
||||
*/
|
||||
projection: import("../proj/Projection.js").default | undefined;
|
||||
}
|
||||
export default DragAndDrop;
|
||||
export type Options = {
|
||||
/**
|
||||
* Format constructors
|
||||
* (and/or formats pre-constructed with options).
|
||||
*/
|
||||
formatConstructors?: (import("../format/Feature.js").default | typeof import("../format/Feature.js").default)[] | undefined;
|
||||
/**
|
||||
* Optional vector source where features will be added. If a source is provided
|
||||
* all existing features will be removed and new features will be added when
|
||||
* they are dropped on the target. If you want to add features to a vector
|
||||
* source without removing the existing features (append only), instead of
|
||||
* providing the source option listen for the "addfeatures" event.
|
||||
*/
|
||||
source?: import("../source/Vector.js").default<import("../geom/Geometry.js").default> | undefined;
|
||||
/**
|
||||
* Target projection. By default, the map's view's projection is used.
|
||||
*/
|
||||
projection?: import("../proj.js").ProjectionLike;
|
||||
/**
|
||||
* The element that is used as the drop target, default is the viewport element.
|
||||
*/
|
||||
target?: HTMLElement | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type DragAndDropOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'addfeatures', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
type DragAndDropEventType = string;
|
||||
declare namespace DragAndDropEventType {
|
||||
const ADD_FEATURES: string;
|
||||
}
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'addfeatures', Return>} DragAndDropOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Handles input of vector data by drag and drop.
|
||||
*
|
||||
* Note that the DragAndDrop interaction uses the TextDecoder() constructor if the supplied
|
||||
* combination of formats read both text string and ArrayBuffer sources. Older browsers such
|
||||
* as IE which do not support this will need a TextDecoder polyfill to be loaded before use.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @fires DragAndDropEvent
|
||||
*/
|
||||
declare class DragAndDrop extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: DragAndDropOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: DragAndDropOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<void>}
|
||||
*/
|
||||
un: DragAndDropOnSignature<void>;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private readAsBuffer_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<import("../format/Feature.js").default>}
|
||||
*/
|
||||
private formats_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../proj/Projection.js").default}
|
||||
*/
|
||||
private projection_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
private dropListenKeys_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../source/Vector.js").default}
|
||||
*/
|
||||
private source_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement|null}
|
||||
*/
|
||||
private target;
|
||||
/**
|
||||
* @param {File} file File.
|
||||
* @param {Event} event Load event.
|
||||
* @private
|
||||
*/
|
||||
private handleResult_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private registerListeners_;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* @param {import("../format/Feature.js").default} format Format.
|
||||
* @param {string} text Text.
|
||||
* @param {import("../format/Feature.js").ReadOptions} options Read options.
|
||||
* @private
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
*/
|
||||
private tryReadFeatures_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private unregisterListeners_;
|
||||
/**
|
||||
* @param {DragEvent} event Event.
|
||||
*/
|
||||
handleDrop(event: DragEvent): void;
|
||||
/**
|
||||
* @param {DragEvent} event Event.
|
||||
*/
|
||||
handleStop(event: DragEvent): void;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=DragAndDrop.d.ts.map
|
||||
1
node_modules/ol/interaction/DragAndDrop.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragAndDrop.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{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IACH,oBAEQ;IAER;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,gBAAqC;IAErC;;;OAGG;IACH,eAAoD;IAGtD;;;;OAIG;IACH,sBAuCC;IAED;;OAEG;IACH,2BAWC;IAkBD;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAQ9C;IAED;;;;;;OAMG;IACH,yBASC;IAED;;OAEG;IACH,6BAKC;IAED;;OAEG;IACH,kBAFW,SAAS,QAiBnB;IAED;;OAEG;IACH,kBAFW,SAAS,QAMnB;CACF"}
|
||||
311
node_modules/ol/interaction/DragAndDrop.js
generated
vendored
Normal file
311
node_modules/ol/interaction/DragAndDrop.js
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
/**
|
||||
* @module ol/interaction/DragAndDrop
|
||||
*/
|
||||
// FIXME should handle all geo-referenced data, not just vector data
|
||||
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 Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import Interaction from './Interaction.js';
|
||||
import { TRUE } from '../functions.js';
|
||||
import { get as getProjection } from '../proj.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {Array<typeof import("../format/Feature.js").default|import("../format/Feature.js").default>} [formatConstructors] Format constructors
|
||||
* (and/or formats pre-constructed with options).
|
||||
* @property {import("../source/Vector.js").default} [source] Optional vector source where features will be added. If a source is provided
|
||||
* all existing features will be removed and new features will be added when
|
||||
* they are dropped on the target. If you want to add features to a vector
|
||||
* source without removing the existing features (append only), instead of
|
||||
* providing the source option listen for the "addfeatures" event.
|
||||
* @property {import("../proj.js").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.
|
||||
* @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.
|
||||
*/
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var DragAndDropEventType = {
|
||||
/**
|
||||
* Triggered when features are added
|
||||
* @event DragAndDropEvent#addfeatures
|
||||
* @api
|
||||
*/
|
||||
ADD_FEATURES: 'addfeatures',
|
||||
};
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances
|
||||
* of this type.
|
||||
*/
|
||||
var DragAndDropEvent = /** @class */ (function (_super) {
|
||||
__extends(DragAndDropEvent, _super);
|
||||
/**
|
||||
* @param {DragAndDropEventType} type Type.
|
||||
* @param {File} file File.
|
||||
* @param {Array<import("../Feature.js").default>} [opt_features] Features.
|
||||
* @param {import("../proj/Projection.js").default} [opt_projection] Projection.
|
||||
*/
|
||||
function DragAndDropEvent(type, file, opt_features, opt_projection) {
|
||||
var _this = _super.call(this, type) || this;
|
||||
/**
|
||||
* The features parsed from dropped data.
|
||||
* @type {Array<import("../Feature.js").FeatureLike>|undefined}
|
||||
* @api
|
||||
*/
|
||||
_this.features = opt_features;
|
||||
/**
|
||||
* The dropped file.
|
||||
* @type {File}
|
||||
* @api
|
||||
*/
|
||||
_this.file = file;
|
||||
/**
|
||||
* The feature projection.
|
||||
* @type {import("../proj/Projection.js").default|undefined}
|
||||
* @api
|
||||
*/
|
||||
_this.projection = opt_projection;
|
||||
return _this;
|
||||
}
|
||||
return DragAndDropEvent;
|
||||
}(Event));
|
||||
export { DragAndDropEvent };
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'addfeatures', Return>} DragAndDropOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Handles input of vector data by drag and drop.
|
||||
*
|
||||
* Note that the DragAndDrop interaction uses the TextDecoder() constructor if the supplied
|
||||
* combination of formats read both text string and ArrayBuffer sources. Older browsers such
|
||||
* as IE which do not support this will need a TextDecoder polyfill to be loaded before use.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @fires DragAndDropEvent
|
||||
*/
|
||||
var DragAndDrop = /** @class */ (function (_super) {
|
||||
__extends(DragAndDrop, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragAndDrop(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
handleEvent: TRUE,
|
||||
}) || this;
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {DragAndDropOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.readAsBuffer_ = false;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<import("../format/Feature.js").default>}
|
||||
*/
|
||||
_this.formats_ = [];
|
||||
var formatConstructors = options.formatConstructors
|
||||
? options.formatConstructors
|
||||
: [];
|
||||
for (var i = 0, ii = formatConstructors.length; i < ii; ++i) {
|
||||
var format = formatConstructors[i];
|
||||
if (typeof format === 'function') {
|
||||
format = new format();
|
||||
}
|
||||
_this.formats_.push(format);
|
||||
_this.readAsBuffer_ =
|
||||
_this.readAsBuffer_ || format.getType() === 'arraybuffer';
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../proj/Projection.js").default}
|
||||
*/
|
||||
_this.projection_ = options.projection
|
||||
? getProjection(options.projection)
|
||||
: null;
|
||||
/**
|
||||
* @private
|
||||
* @type {?Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
_this.dropListenKeys_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../source/Vector.js").default}
|
||||
*/
|
||||
_this.source_ = options.source || null;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLElement|null}
|
||||
*/
|
||||
_this.target = options.target ? options.target : null;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {File} file File.
|
||||
* @param {Event} event Load event.
|
||||
* @private
|
||||
*/
|
||||
DragAndDrop.prototype.handleResult_ = function (file, event) {
|
||||
var result = event.target.result;
|
||||
var map = this.getMap();
|
||||
var projection = this.projection_;
|
||||
if (!projection) {
|
||||
var view = map.getView();
|
||||
projection = view.getProjection();
|
||||
}
|
||||
var text;
|
||||
var formats = this.formats_;
|
||||
for (var i = 0, ii = formats.length; i < ii; ++i) {
|
||||
var format = formats[i];
|
||||
var input = result;
|
||||
if (this.readAsBuffer_ && format.getType() !== 'arraybuffer') {
|
||||
if (text === undefined) {
|
||||
text = new TextDecoder().decode(result);
|
||||
}
|
||||
input = text;
|
||||
}
|
||||
var features = this.tryReadFeatures_(format, input, {
|
||||
featureProjection: projection,
|
||||
});
|
||||
if (features && features.length > 0) {
|
||||
if (this.source_) {
|
||||
this.source_.clear();
|
||||
this.source_.addFeatures(features);
|
||||
}
|
||||
this.dispatchEvent(new DragAndDropEvent(DragAndDropEventType.ADD_FEATURES, file, features, projection));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
DragAndDrop.prototype.registerListeners_ = function () {
|
||||
var map = this.getMap();
|
||||
if (map) {
|
||||
var dropArea = this.target ? this.target : map.getViewport();
|
||||
this.dropListenKeys_ = [
|
||||
listen(dropArea, EventType.DROP, this.handleDrop, this),
|
||||
listen(dropArea, EventType.DRAGENTER, this.handleStop, this),
|
||||
listen(dropArea, EventType.DRAGOVER, this.handleStop, this),
|
||||
listen(dropArea, EventType.DROP, this.handleStop, this),
|
||||
];
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Activate or deactivate the interaction.
|
||||
* @param {boolean} active Active.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
DragAndDrop.prototype.setActive = function (active) {
|
||||
if (!this.getActive() && active) {
|
||||
this.registerListeners_();
|
||||
}
|
||||
if (this.getActive() && !active) {
|
||||
this.unregisterListeners_();
|
||||
}
|
||||
_super.prototype.setActive.call(this, active);
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
DragAndDrop.prototype.setMap = function (map) {
|
||||
this.unregisterListeners_();
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (this.getActive()) {
|
||||
this.registerListeners_();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../format/Feature.js").default} format Format.
|
||||
* @param {string} text Text.
|
||||
* @param {import("../format/Feature.js").ReadOptions} options Read options.
|
||||
* @private
|
||||
* @return {Array<import("../Feature.js").default>} Features.
|
||||
*/
|
||||
DragAndDrop.prototype.tryReadFeatures_ = function (format, text, options) {
|
||||
try {
|
||||
return (
|
||||
/** @type {Array<import("../Feature.js").default>} */
|
||||
(format.readFeatures(text, options)));
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
DragAndDrop.prototype.unregisterListeners_ = function () {
|
||||
if (this.dropListenKeys_) {
|
||||
this.dropListenKeys_.forEach(unlistenByKey);
|
||||
this.dropListenKeys_ = null;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {DragEvent} event Event.
|
||||
*/
|
||||
DragAndDrop.prototype.handleDrop = function (event) {
|
||||
var files = event.dataTransfer.files;
|
||||
for (var i = 0, ii = files.length; i < ii; ++i) {
|
||||
var file = files.item(i);
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener(EventType.LOAD, this.handleResult_.bind(this, file));
|
||||
if (this.readAsBuffer_) {
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
else {
|
||||
reader.readAsText(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {DragEvent} event Event.
|
||||
*/
|
||||
DragAndDrop.prototype.handleStop = function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
};
|
||||
return DragAndDrop;
|
||||
}(Interaction));
|
||||
export default DragAndDrop;
|
||||
//# sourceMappingURL=DragAndDrop.js.map
|
||||
1
node_modules/ol/interaction/DragAndDrop.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragAndDrop.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
153
node_modules/ol/interaction/DragBox.d.ts
generated
vendored
Normal file
153
node_modules/ol/interaction/DragBox.d.ts
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of
|
||||
* this type.
|
||||
*/
|
||||
export class DragBoxEvent extends Event {
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
|
||||
*/
|
||||
constructor(type: string, coordinate: import("../coordinate.js").Coordinate, mapBrowserEvent: import("../MapBrowserEvent.js").default<any>);
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
coordinate: import("../coordinate.js").Coordinate;
|
||||
/**
|
||||
* @const
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
mapBrowserEvent: import("../MapBrowserEvent.js").default<any>;
|
||||
}
|
||||
export default DragBox;
|
||||
/**
|
||||
* A function that takes a {@link module :ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* {@link module :ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
|
||||
* true should be returned.
|
||||
*/
|
||||
export type EndCondition = (this: unknown, arg1: import("../MapBrowserEvent.js").default<any>, arg2: import("../pixel.js").Pixel, arg3: import("../pixel.js").Pixel) => boolean;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name for styling the box.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* A function that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link ol /events/condition~mouseActionButton}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* The minimum area of the box in pixel, this value is used by the default
|
||||
* `boxEndCondition` function.
|
||||
*/
|
||||
minArea?: number | undefined;
|
||||
/**
|
||||
* A function that takes a {@link module :ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* {@link module :ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
|
||||
* Default is `true` if the area of the box is bigger than the `minArea` option.
|
||||
*/
|
||||
boxEndCondition?: EndCondition | undefined;
|
||||
/**
|
||||
* Code to execute just
|
||||
* before `boxend` is fired.
|
||||
*/
|
||||
onBoxEnd?: ((this: DragBox, arg1: import("../MapBrowserEvent.js").default<any>) => void) | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type DragBoxOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'boxcancel' | 'boxdrag' | 'boxend' | 'boxstart', DragBoxEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'boxcancel' | 'boxdrag' | 'boxend', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'boxcancel'|'boxdrag'|'boxend', Return>} DragBoxOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when the shift or other key is held down. This is used, for example,
|
||||
* for zooming to a specific area of the map
|
||||
* (see {@link module:ol/interaction/DragZoom~DragZoom} and
|
||||
* {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).
|
||||
*
|
||||
* @fires DragBoxEvent
|
||||
* @api
|
||||
*/
|
||||
declare class DragBox extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {DragBoxOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: DragBoxOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DragBoxOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: DragBoxOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DragBoxOnSignature<void>}
|
||||
*/
|
||||
un: DragBoxOnSignature<void>;
|
||||
/**
|
||||
* @type {import("../render/Box.js").default}
|
||||
* @private
|
||||
*/
|
||||
private box_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private minArea_;
|
||||
/**
|
||||
* Function to execute just before `onboxend` is fired
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
*/
|
||||
onBoxEnd(event: import("../MapBrowserEvent.js").default<any>): void;
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
* @private
|
||||
*/
|
||||
private startPixel_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {EndCondition}
|
||||
*/
|
||||
private boxEndCondition_;
|
||||
/**
|
||||
* The default condition for determining whether the boxend event
|
||||
* should fire.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
|
||||
* leading to the box end.
|
||||
* @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
|
||||
* @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
|
||||
* @return {boolean} Whether or not the boxend condition should be fired.
|
||||
*/
|
||||
defaultBoxEndCondition(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>, startPixel: import("../pixel.js").Pixel, endPixel: import("../pixel.js").Pixel): boolean;
|
||||
/**
|
||||
* Returns geometry of last drawn box.
|
||||
* @return {import("../geom/Polygon.js").default} Geometry.
|
||||
* @api
|
||||
*/
|
||||
getGeometry(): import("../geom/Polygon.js").default;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=DragBox.d.ts.map
|
||||
1
node_modules/ol/interaction/DragBox.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Drag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,CAE3B;IAIP;;;OAGG;IACH,aAA4D;IAE5D;;;OAGG;IACH,iBAAoE;IAoHtE;;;OAGG;IACH,oEAAkB;IAlHhB;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,mBAA2E;IAE3E;;;OAGG;IACH,yBAE+B;IAGjC;;;;;;;;OAQG;IACH,kGAJW,OAAO,aAAa,EAAE,KAAK,YAC3B,OAAO,aAAa,EAAE,KAAK,GAC1B,OAAO,CAMlB;IAED;;;;OAIG;IACH,eAHY,OAAO,oBAAoB,EAAE,OAAO,CAK/C;CAwEF"}
|
||||
247
node_modules/ol/interaction/DragBox.js
generated
vendored
Normal file
247
node_modules/ol/interaction/DragBox.js
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
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/interaction/DragBox
|
||||
*/
|
||||
// FIXME draw drag box
|
||||
import Event from '../events/Event.js';
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import RenderBox from '../render/Box.js';
|
||||
import { mouseActionButton } from '../events/condition.js';
|
||||
/**
|
||||
* A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
|
||||
* true should be returned.
|
||||
* @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-dragbox'] CSS class name for styling the box.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link ol/events/condition~mouseActionButton}.
|
||||
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
|
||||
* `boxEndCondition` function.
|
||||
* @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
|
||||
* Default is `true` if the area of the box is bigger than the `minArea` option.
|
||||
* @property {function(this:DragBox, import("../MapBrowserEvent.js").default):void} [onBoxEnd] Code to execute just
|
||||
* before `boxend` is fired.
|
||||
*/
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var DragBoxEventType = {
|
||||
/**
|
||||
* Triggered upon drag box start.
|
||||
* @event DragBoxEvent#boxstart
|
||||
* @api
|
||||
*/
|
||||
BOXSTART: 'boxstart',
|
||||
/**
|
||||
* Triggered on drag when box is active.
|
||||
* @event DragBoxEvent#boxdrag
|
||||
* @api
|
||||
*/
|
||||
BOXDRAG: 'boxdrag',
|
||||
/**
|
||||
* Triggered upon drag box end.
|
||||
* @event DragBoxEvent#boxend
|
||||
* @api
|
||||
*/
|
||||
BOXEND: 'boxend',
|
||||
/**
|
||||
* Triggered upon drag box canceled.
|
||||
* @event DragBoxEvent#boxcancel
|
||||
* @api
|
||||
*/
|
||||
BOXCANCEL: 'boxcancel',
|
||||
};
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of
|
||||
* this type.
|
||||
*/
|
||||
var DragBoxEvent = /** @class */ (function (_super) {
|
||||
__extends(DragBoxEvent, _super);
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
|
||||
*/
|
||||
function DragBoxEvent(type, coordinate, mapBrowserEvent) {
|
||||
var _this = _super.call(this, type) || this;
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
_this.coordinate = coordinate;
|
||||
/**
|
||||
* @const
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
_this.mapBrowserEvent = mapBrowserEvent;
|
||||
return _this;
|
||||
}
|
||||
return DragBoxEvent;
|
||||
}(Event));
|
||||
export { DragBoxEvent };
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'boxcancel'|'boxdrag'|'boxend'|'boxstart', DragBoxEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'boxcancel'|'boxdrag'|'boxend', Return>} DragBoxOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when the shift or other key is held down. This is used, for example,
|
||||
* for zooming to a specific area of the map
|
||||
* (see {@link module:ol/interaction/DragZoom~DragZoom} and
|
||||
* {@link module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}).
|
||||
*
|
||||
* @fires DragBoxEvent
|
||||
* @api
|
||||
*/
|
||||
var DragBox = /** @class */ (function (_super) {
|
||||
__extends(DragBox, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragBox(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
/***
|
||||
* @type {DragBoxOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {DragBoxOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {DragBoxOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
var options = opt_options ? opt_options : {};
|
||||
/**
|
||||
* @type {import("../render/Box.js").default}
|
||||
* @private
|
||||
*/
|
||||
_this.box_ = new RenderBox(options.className || 'ol-dragbox');
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
|
||||
if (options.onBoxEnd) {
|
||||
_this.onBoxEnd = options.onBoxEnd;
|
||||
}
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
* @private
|
||||
*/
|
||||
_this.startPixel_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : mouseActionButton;
|
||||
/**
|
||||
* @private
|
||||
* @type {EndCondition}
|
||||
*/
|
||||
_this.boxEndCondition_ = options.boxEndCondition
|
||||
? options.boxEndCondition
|
||||
: _this.defaultBoxEndCondition;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* The default condition for determining whether the boxend event
|
||||
* should fire.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
|
||||
* leading to the box end.
|
||||
* @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
|
||||
* @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
|
||||
* @return {boolean} Whether or not the boxend condition should be fired.
|
||||
*/
|
||||
DragBox.prototype.defaultBoxEndCondition = function (mapBrowserEvent, startPixel, endPixel) {
|
||||
var width = endPixel[0] - startPixel[0];
|
||||
var height = endPixel[1] - startPixel[1];
|
||||
return width * width + height * height >= this.minArea_;
|
||||
};
|
||||
/**
|
||||
* Returns geometry of last drawn box.
|
||||
* @return {import("../geom/Polygon.js").default} Geometry.
|
||||
* @api
|
||||
*/
|
||||
DragBox.prototype.getGeometry = function () {
|
||||
return this.box_.getGeometry();
|
||||
};
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
DragBox.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
||||
this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragBox.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
this.box_.setMap(null);
|
||||
var completeBox = this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel);
|
||||
if (completeBox) {
|
||||
this.onBoxEnd(mapBrowserEvent);
|
||||
}
|
||||
this.dispatchEvent(new DragBoxEvent(completeBox ? DragBoxEventType.BOXEND : DragBoxEventType.BOXCANCEL, mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragBox.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (this.condition_(mapBrowserEvent)) {
|
||||
this.startPixel_ = mapBrowserEvent.pixel;
|
||||
this.box_.setMap(mapBrowserEvent.map);
|
||||
this.box_.setPixels(this.startPixel_, this.startPixel_);
|
||||
this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Function to execute just before `onboxend` is fired
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
*/
|
||||
DragBox.prototype.onBoxEnd = function (event) { };
|
||||
return DragBox;
|
||||
}(PointerInteraction));
|
||||
export default DragBox;
|
||||
//# sourceMappingURL=DragBox.js.map
|
||||
1
node_modules/ol/interaction/DragBox.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragBox.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragBox.js","sourceRoot":"","sources":["../src/interaction/DragBox.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,sBAAsB;AACtB,OAAO,KAAK,MAAM,oBAAoB,CAAC;AACvC,OAAO,kBAAkB,MAAM,cAAc,CAAC;AAC9C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,IAAM,gBAAgB,GAAG;IACvB;;;;OAIG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;;OAIG;IACH,OAAO,EAAE,SAAS;IAElB;;;;OAIG;IACH,MAAM,EAAE,QAAQ;IAEhB;;;;OAIG;IACH,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF;;;;GAIG;AACH;IAAkC,gCAAK;IACrC;;;;OAIG;IACH,sBAAY,IAAI,EAAE,UAAU,EAAE,eAAe;QAA7C,YACE,kBAAM,IAAI,CAAC,SAgBZ;QAdC;;;;;WAKG;QACH,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B;;;;WAIG;QACH,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;;IACzC,CAAC;IACH,mBAAC;AA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AAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACxD,IAAI,CAAC,aAAa,CAChB,IAAI,YAAY,CACd,gBAAgB,CAAC,QAAQ,EACzB,eAAe,CAAC,UAAU,EAC1B,eAAe,CAChB,CACF,CAAC;YACF,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IAED;;;OAGG;IACH,0BAAQ,GAAR,UAAS,KAAK,IAAG,CAAC;IACpB,cAAC;AAAD,CAAC,AA3JD,CAAsB,kBAAkB,GA2JvC;AAED,eAAe,OAAO,CAAC"}
|
||||
67
node_modules/ol/interaction/DragPan.d.ts
generated
vendored
Normal file
67
node_modules/ol/interaction/DragPan.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
export default DragPan;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.noModifierKeys} and {@link module :ol/events/condition.primaryAction}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
*/
|
||||
onFocusOnly?: boolean | undefined;
|
||||
/**
|
||||
* Kinetic inertia to apply to the pan.
|
||||
*/
|
||||
kinetic?: import("../Kinetic.js").default | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.
|
||||
* @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
* @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to pan the map by dragging the map.
|
||||
* @api
|
||||
*/
|
||||
declare class DragPan extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../Kinetic.js").default|undefined}
|
||||
*/
|
||||
private kinetic_;
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
*/
|
||||
lastCentroid: import("../pixel.js").Pixel;
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
lastPointersCount_: number;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
panning_: boolean;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private noKinetic_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=DragPan.d.ts.map
|
||||
1
node_modules/ol/interaction/DragPan.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragPan.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragPan.d.ts","sourceRoot":"","sources":["../src/interaction/DragPan.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CA6CC;IAtCC;;;OAGG;IACH,iBAA+B;IAE/B;;OAEG;IACH,cAFU,OAAO,aAAa,EAAE,KAAK,CAEb;IAExB;;OAEG;IACH,oBAFU,MAAM,CAEO;IAEvB;;OAEG;IACH,UAFU,OAAO,CAEI;IAMrB;;;OAGG;IACH,mBAEa;IAEb;;;OAGG;IACH,mBAAuB;CAwG1B"}
|
||||
187
node_modules/ol/interaction/DragPan.js
generated
vendored
Normal file
187
node_modules/ol/interaction/DragPan.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
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/interaction/DragPan
|
||||
*/
|
||||
import PointerInteraction, { centroid as centroidFromPointers, } from './Pointer.js';
|
||||
import { FALSE } from '../functions.js';
|
||||
import { all, focusWithTabindex, noModifierKeys, primaryAction, } from '../events/condition.js';
|
||||
import { easeOut } from '../easing.js';
|
||||
import { rotate as rotateCoordinate, scale as scaleCoordinate, } from '../coordinate.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.noModifierKeys} and {@link module:ol/events/condition.primaryAction}.
|
||||
* @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
* @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to pan the map by dragging the map.
|
||||
* @api
|
||||
*/
|
||||
var DragPan = /** @class */ (function (_super) {
|
||||
__extends(DragPan, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragPan(opt_options) {
|
||||
var _this = _super.call(this, {
|
||||
stopDown: FALSE,
|
||||
}) || this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../Kinetic.js").default|undefined}
|
||||
*/
|
||||
_this.kinetic_ = options.kinetic;
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
*/
|
||||
_this.lastCentroid = null;
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
_this.lastPointersCount_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.panning_ = false;
|
||||
var condition = options.condition
|
||||
? options.condition
|
||||
: all(noModifierKeys, primaryAction);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.onFocusOnly
|
||||
? all(focusWithTabindex, condition)
|
||||
: condition;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.noKinetic_ = false;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
DragPan.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
if (!this.panning_) {
|
||||
this.panning_ = true;
|
||||
this.getMap().getView().beginInteraction();
|
||||
}
|
||||
var targetPointers = this.targetPointers;
|
||||
var centroid = centroidFromPointers(targetPointers);
|
||||
if (targetPointers.length == this.lastPointersCount_) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(centroid[0], centroid[1]);
|
||||
}
|
||||
if (this.lastCentroid) {
|
||||
var delta = [
|
||||
this.lastCentroid[0] - centroid[0],
|
||||
centroid[1] - this.lastCentroid[1],
|
||||
];
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
scaleCoordinate(delta, view.getResolution());
|
||||
rotateCoordinate(delta, view.getRotation());
|
||||
view.adjustCenterInternal(delta);
|
||||
}
|
||||
}
|
||||
else if (this.kinetic_) {
|
||||
// reset so we don't overestimate the kinetic energy after
|
||||
// after one finger down, tiny drag, second finger down
|
||||
this.kinetic_.begin();
|
||||
}
|
||||
this.lastCentroid = centroid;
|
||||
this.lastPointersCount_ = targetPointers.length;
|
||||
mapBrowserEvent.originalEvent.preventDefault();
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragPan.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
if (this.targetPointers.length === 0) {
|
||||
if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
|
||||
var distance = this.kinetic_.getDistance();
|
||||
var angle = this.kinetic_.getAngle();
|
||||
var center = view.getCenterInternal();
|
||||
var centerpx = map.getPixelFromCoordinateInternal(center);
|
||||
var dest = map.getCoordinateFromPixelInternal([
|
||||
centerpx[0] - distance * Math.cos(angle),
|
||||
centerpx[1] - distance * Math.sin(angle),
|
||||
]);
|
||||
view.animateInternal({
|
||||
center: view.getConstrainedCenter(dest),
|
||||
duration: 500,
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
if (this.panning_) {
|
||||
this.panning_ = false;
|
||||
view.endInteraction();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if (this.kinetic_) {
|
||||
// reset so we don't overestimate the kinetic energy after
|
||||
// after one finger up, tiny drag, second finger up
|
||||
this.kinetic_.begin();
|
||||
}
|
||||
this.lastCentroid = null;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragPan.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
this.lastCentroid = null;
|
||||
// stop any current animation
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.begin();
|
||||
}
|
||||
// No kinetic as soon as more than one pointer on the screen is
|
||||
// detected. This is to prevent nasty pans after pinch.
|
||||
this.noKinetic_ = this.targetPointers.length > 1;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return DragPan;
|
||||
}(PointerInteraction));
|
||||
export default DragPan;
|
||||
//# sourceMappingURL=DragPan.js.map
|
||||
1
node_modules/ol/interaction/DragPan.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragPan.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragPan.js","sourceRoot":"","sources":["../src/interaction/DragPan.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,kBAAkB,EAAE,EACzB,QAAQ,IAAI,oBAAoB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EACL,GAAG,EACH,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,MAAM,IAAI,gBAAgB,EAC1B,KAAK,IAAI,eAAe,GACzB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;GAQG;AAEH;;;;GAIG;AACH;IAAsB,2BAAkB;IACtC;;OAEG;IACH,iBAAY,WAAW;QAAvB,YACE,kBAAM;YACJ,Q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YAAY,GAAG,IAAI,CAAC;YACzB,6BAA6B;YAC7B,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE;gBACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;aACzB;YACD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;aACvB;YACD,+DAA+D;YAC/D,uDAAuD;YACvD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IACH,cAAC;AAAD,CAAC,AAxJD,CAAsB,kBAAkB,GAwJvC;AAED,eAAe,OAAO,CAAC"}
|
||||
54
node_modules/ol/interaction/DragRotate.d.ts
generated
vendored
Normal file
54
node_modules/ol/interaction/DragRotate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
export default DragRotate;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that takes an
|
||||
* {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.altShiftKeysOnly}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an
|
||||
* {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.altShiftKeysOnly}.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to rotate the map by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when the alt and shift keys are held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
* @api
|
||||
*/
|
||||
declare class DragRotate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lastAngle_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=DragRotate.d.ts.map
|
||||
1
node_modules/ol/interaction/DragRotate.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragRotate.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragRotate.d.ts","sourceRoot":"","sources":["../src/interaction/DragRotate.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAYA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,+CAwBC;IAjBC;;;OAGG;IACH,mBAA0E;IAE1E;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,kBAAwE;CAiE3E"}
|
||||
127
node_modules/ol/interaction/DragRotate.js
generated
vendored
Normal file
127
node_modules/ol/interaction/DragRotate.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
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/interaction/DragRotate
|
||||
*/
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import { FALSE } from '../functions.js';
|
||||
import { altShiftKeysOnly, mouseActionButton, mouseOnly, } from '../events/condition.js';
|
||||
import { disable } from '../rotationconstraint.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an
|
||||
* {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.altShiftKeysOnly}.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to rotate the map by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when the alt and shift keys are held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
* @api
|
||||
*/
|
||||
var DragRotate = /** @class */ (function (_super) {
|
||||
__extends(DragRotate, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragRotate(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, {
|
||||
stopDown: FALSE,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
DragRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return;
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
if (view.getConstraints().rotation === disable) {
|
||||
return;
|
||||
}
|
||||
var size = map.getSize();
|
||||
var offset = mapBrowserEvent.pixel;
|
||||
var theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
var delta = theta - this.lastAngle_;
|
||||
view.adjustRotationInternal(-delta);
|
||||
}
|
||||
this.lastAngle_ = theta;
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
view.endInteraction(this.duration_);
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return false;
|
||||
}
|
||||
if (mouseActionButton(mapBrowserEvent) &&
|
||||
this.condition_(mapBrowserEvent)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
map.getView().beginInteraction();
|
||||
this.lastAngle_ = undefined;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return DragRotate;
|
||||
}(PointerInteraction));
|
||||
export default DragRotate;
|
||||
//# sourceMappingURL=DragRotate.js.map
|
||||
1
node_modules/ol/interaction/DragRotate.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragRotate.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragRotate.js","sourceRoot":"","sources":["../src/interaction/DragRotate.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,kBAAkB,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AAEjD;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH;IAAyB,8BAAkB;IACzC;;OAEG;IACH,oBAAY,WAAW;QAAvB,iBAwBC;QAvBC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBAE/C,kBAAM;YACJ,QAAQ,EAAE,KAAK;SAChB,CAAC;QAEF;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAE3E;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;;IAC3E,CAAC;IAED;;;OAGG;IACH,oCAAe,GAAf,UAAgB,eAAe;QAC7B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE;YAC/B,OAAO;SACR;QAED,IAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;QAChC,IAAM,IAAI,GAAG,GAAG,CAAC,OAA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AE,CAAC,gBAAgB,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AA5FD,CAAyB,kBAAkB,GA4F1C;AAED,eAAe,UAAU,CAAC"}
|
||||
66
node_modules/ol/interaction/DragRotateAndZoom.d.ts
generated
vendored
Normal file
66
node_modules/ol/interaction/DragRotateAndZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
export default DragRotateAndZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.shiftKeyOnly}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.shiftKeyOnly}.
|
||||
* @property {number} [duration=400] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom and rotate the map by clicking and dragging
|
||||
* on the map. By default, this interaction is limited to when the shift
|
||||
* key is held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* And this interaction is not included in the default interactions.
|
||||
* @api
|
||||
*/
|
||||
declare class DragRotateAndZoom extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lastAngle_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lastMagnitude_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private lastScaleDelta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=DragRotateAndZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/DragRotateAndZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragRotateAndZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragRotateAndZoom.d.ts","sourceRoot":"","sources":["../src/interaction/DragRotateAndZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAMA;;;;;;;GAOG;AAEH;;;;;;;;;;GAUG;AACH;IACE;;OAEG;IACH,+CAkCC;IA7BC;;;OAGG;IACH,mBAAsE;IAEtE;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,uBAA+B;IAE/B;;;OAGG;IACH,wBAAwB;IAExB;;;OAGG;IACH,kBAAwE;CAuE3E"}
|
||||
143
node_modules/ol/interaction/DragRotateAndZoom.js
generated
vendored
Normal file
143
node_modules/ol/interaction/DragRotateAndZoom.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/interaction/DragRotateAndZoom
|
||||
*/
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import { mouseOnly, shiftKeyOnly } from '../events/condition.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.shiftKeyOnly}.
|
||||
* @property {number} [duration=400] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom and rotate the map by clicking and dragging
|
||||
* on the map. By default, this interaction is limited to when the shift
|
||||
* key is held down.
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* And this interaction is not included in the default interactions.
|
||||
* @api
|
||||
*/
|
||||
var DragRotateAndZoom = /** @class */ (function (_super) {
|
||||
__extends(DragRotateAndZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragRotateAndZoom(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : shiftKeyOnly;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.lastMagnitude_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.lastScaleDelta_ = 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
DragRotateAndZoom.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return;
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
var size = map.getSize();
|
||||
var offset = mapBrowserEvent.pixel;
|
||||
var deltaX = offset[0] - size[0] / 2;
|
||||
var deltaY = size[1] / 2 - offset[1];
|
||||
var theta = Math.atan2(deltaY, deltaX);
|
||||
var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
var view = map.getView();
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
var angleDelta = this.lastAngle_ - theta;
|
||||
view.adjustRotationInternal(angleDelta);
|
||||
}
|
||||
this.lastAngle_ = theta;
|
||||
if (this.lastMagnitude_ !== undefined) {
|
||||
view.adjustResolutionInternal(this.lastMagnitude_ / magnitude);
|
||||
}
|
||||
if (this.lastMagnitude_ !== undefined) {
|
||||
this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
|
||||
}
|
||||
this.lastMagnitude_ = magnitude;
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragRotateAndZoom.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
var direction = this.lastScaleDelta_ > 1 ? 1 : -1;
|
||||
view.endInteraction(this.duration_, direction);
|
||||
this.lastScaleDelta_ = 0;
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
DragRotateAndZoom.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
return false;
|
||||
}
|
||||
if (this.condition_(mapBrowserEvent)) {
|
||||
mapBrowserEvent.map.getView().beginInteraction();
|
||||
this.lastAngle_ = undefined;
|
||||
this.lastMagnitude_ = undefined;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return DragRotateAndZoom;
|
||||
}(PointerInteraction));
|
||||
export default DragRotateAndZoom;
|
||||
//# sourceMappingURL=DragRotateAndZoom.js.map
|
||||
1
node_modules/ol/interaction/DragRotateAndZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragRotateAndZoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragRotateAndZoom.js","sourceRoot":"","sources":["../src/interaction/DragRotateAndZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,kBAAkB,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;GAOG;AAEH;;;;;;;;;;GAUG;AACH;IAAgC,qCAAkB;IAChD;;OAEG;IACH,2BAAY,WAAW;QAAvB,iBAkCC;QAjCC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBAE/C,kBAAM,6CAA6C,CAAC,CAAC,OAAO,CAAC,CAAC;QAE9D;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;QAEvE;;;WAGG;QACH,KA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e,iBAAiB,CAAC"}
|
||||
69
node_modules/ol/interaction/DragZoom.d.ts
generated
vendored
Normal file
69
node_modules/ol/interaction/DragZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
export default DragZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* CSS class name for styling the
|
||||
* box.
|
||||
*/
|
||||
className?: string | undefined;
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.shiftKeyOnly}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* Use interaction for zooming out.
|
||||
*/
|
||||
out?: boolean | undefined;
|
||||
/**
|
||||
* The minimum area of the box in pixel, this value is used by the parent default
|
||||
* `boxEndCondition` function.
|
||||
*/
|
||||
minArea?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-dragzoom'] CSS class name for styling the
|
||||
* box.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.shiftKeyOnly}.
|
||||
* @property {number} [duration=200] Animation duration in milliseconds.
|
||||
* @property {boolean} [out=false] Use interaction for zooming out.
|
||||
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default
|
||||
* `boxEndCondition` function.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when a key, shift by default, is held down.
|
||||
*
|
||||
* To change the style of the box, use CSS and the `.ol-dragzoom` selector, or
|
||||
* your custom one configured with `className`.
|
||||
* @api
|
||||
*/
|
||||
declare class DragZoom extends DragBox {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private out_;
|
||||
}
|
||||
import DragBox from "./DragBox.js";
|
||||
//# sourceMappingURL=DragZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/DragZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragZoom.d.ts","sourceRoot":"","sources":["../src/interaction/DragZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;GASG;AACH;IACE;;OAEG;IACH,+CAsBC;IAXC;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,aAA2D;CAyB9D"}
|
||||
94
node_modules/ol/interaction/DragZoom.js
generated
vendored
Normal file
94
node_modules/ol/interaction/DragZoom.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/interaction/DragZoom
|
||||
*/
|
||||
import DragBox from './DragBox.js';
|
||||
import { easeOut } from '../easing.js';
|
||||
import { shiftKeyOnly } from '../events/condition.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-dragzoom'] CSS class name for styling the
|
||||
* box.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.shiftKeyOnly}.
|
||||
* @property {number} [duration=200] Animation duration in milliseconds.
|
||||
* @property {boolean} [out=false] Use interaction for zooming out.
|
||||
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default
|
||||
* `boxEndCondition` function.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by clicking and dragging on the map,
|
||||
* normally combined with an {@link module:ol/events/condition} that limits
|
||||
* it to when a key, shift by default, is held down.
|
||||
*
|
||||
* To change the style of the box, use CSS and the `.ol-dragzoom` selector, or
|
||||
* your custom one configured with `className`.
|
||||
* @api
|
||||
*/
|
||||
var DragZoom = /** @class */ (function (_super) {
|
||||
__extends(DragZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function DragZoom(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var condition = options.condition ? options.condition : shiftKeyOnly;
|
||||
_this = _super.call(this, {
|
||||
condition: condition,
|
||||
className: options.className || 'ol-dragzoom',
|
||||
minArea: options.minArea,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 200;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.out_ = options.out !== undefined ? options.out : false;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Function to execute just before `onboxend` is fired
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
*/
|
||||
DragZoom.prototype.onBoxEnd = function (event) {
|
||||
var map = this.getMap();
|
||||
var view = /** @type {!import("../View.js").default} */ (map.getView());
|
||||
var geometry = this.getGeometry();
|
||||
if (this.out_) {
|
||||
var rotatedExtent = view.rotatedExtentForGeometry(geometry);
|
||||
var resolution = view.getResolutionForExtentInternal(rotatedExtent);
|
||||
var factor = view.getResolution() / resolution;
|
||||
geometry = geometry.clone();
|
||||
geometry.scale(factor * factor);
|
||||
}
|
||||
view.fitInternal(geometry, {
|
||||
duration: this.duration_,
|
||||
easing: easeOut,
|
||||
});
|
||||
};
|
||||
return DragZoom;
|
||||
}(DragBox));
|
||||
export default DragZoom;
|
||||
//# sourceMappingURL=DragZoom.js.map
|
||||
1
node_modules/ol/interaction/DragZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/DragZoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DragZoom.js","sourceRoot":"","sources":["../src/interaction/DragZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;GASG;AACH;IAAuB,4BAAO;IAC5B;;OAEG;IACH,kBAAY,WAAW;QAAvB,iBAsBC;QArBC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/C,IAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;gBAEvE,kBAAM;YACJ,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,aA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
generated
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
/**
|
||||
* Create a `geometryFunction` for `type: 'Circle'` that will create a regular
|
||||
* polygon with a user specified number of sides and start angle instead of a
|
||||
* {@link import("../geom/Circle.js").Circle} geometry.
|
||||
* @param {number} [opt_sides] Number of sides of the regular polygon.
|
||||
* Default is 32.
|
||||
* @param {number} [opt_angle] Angle of the first point in counter-clockwise
|
||||
* radians. 0 means East.
|
||||
* Default is the angle defined by the heading from the center of the
|
||||
* regular polygon to the current pointer position.
|
||||
* @return {GeometryFunction} Function that draws a polygon.
|
||||
* @api
|
||||
*/
|
||||
export function createRegularPolygon(opt_sides?: number | undefined, opt_angle?: number | undefined): GeometryFunction;
|
||||
/**
|
||||
* Create a `geometryFunction` that will create a box-shaped polygon (aligned
|
||||
* with the coordinate system axes). Use this with the draw interaction and
|
||||
* `type: 'Circle'` to return a box instead of a circle geometry.
|
||||
* @return {GeometryFunction} Function that draws a box-shaped polygon.
|
||||
* @api
|
||||
*/
|
||||
export function createBox(): GeometryFunction;
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Draw~Draw} instances are
|
||||
* instances of this type.
|
||||
*/
|
||||
export class DrawEvent extends Event {
|
||||
/**
|
||||
* @param {DrawEventType} type Type.
|
||||
* @param {Feature} feature The feature drawn.
|
||||
*/
|
||||
constructor(type: DrawEventType, feature: Feature);
|
||||
/**
|
||||
* The feature being drawn.
|
||||
* @type {Feature}
|
||||
* @api
|
||||
*/
|
||||
feature: Feature;
|
||||
}
|
||||
export default Draw;
|
||||
export type Options = {
|
||||
/**
|
||||
* Geometry type of
|
||||
* the geometries being drawn with this instance.
|
||||
*/
|
||||
type: import("../geom/Geometry.js").Type;
|
||||
/**
|
||||
* The maximum distance in pixels between
|
||||
* "down" and "up" for a "up" event to be considered a "click" event and
|
||||
* actually add a point/vertex to the geometry being drawn. The default of `6`
|
||||
* was chosen for the draw interaction to behave correctly on mouse as well as
|
||||
* on touch devices.
|
||||
*/
|
||||
clickTolerance?: number | undefined;
|
||||
/**
|
||||
* Destination collection for the drawn features.
|
||||
*/
|
||||
features?: import("../Collection.js").default<Feature<import("../geom/Geometry.js").default>> | undefined;
|
||||
/**
|
||||
* Destination source for
|
||||
* the drawn features.
|
||||
*/
|
||||
source?: VectorSource<import("../geom/Geometry.js").default> | undefined;
|
||||
/**
|
||||
* Delay in milliseconds after pointerdown
|
||||
* before the current vertex can be dragged to its exact position.
|
||||
*/
|
||||
dragVertexDelay?: number | undefined;
|
||||
/**
|
||||
* Pixel distance for snapping to the
|
||||
* drawing finish. Must be greater than `0`.
|
||||
*/
|
||||
snapTolerance?: number | undefined;
|
||||
/**
|
||||
* Stop click, singleclick, and
|
||||
* doubleclick events from firing during drawing.
|
||||
*/
|
||||
stopClick?: boolean | undefined;
|
||||
/**
|
||||
* The number of points that can be drawn before
|
||||
* a polygon ring or line string is finished. By default there is no
|
||||
* restriction.
|
||||
*/
|
||||
maxPoints?: number | undefined;
|
||||
/**
|
||||
* The number of points that must be drawn
|
||||
* before a polygon ring or line string can be finished. Default is `3` for
|
||||
* polygon rings and `2` for line strings.
|
||||
*/
|
||||
minPoints?: number | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether the drawing can be finished. Not used when drawing
|
||||
* POINT or MULTI_POINT geometries.
|
||||
*/
|
||||
finishCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Style for sketch features.
|
||||
*/
|
||||
style?: import("../style/Style.js").StyleLike | undefined;
|
||||
/**
|
||||
* Function that is called when a geometry's coordinates are updated.
|
||||
*/
|
||||
geometryFunction?: GeometryFunction | undefined;
|
||||
/**
|
||||
* Geometry name to use for features created
|
||||
* by the draw interaction.
|
||||
*/
|
||||
geometryName?: string | undefined;
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default {@link module :ol/events/condition.noModifierKeys}, i.e. a click,
|
||||
* adds a vertex or deactivates freehand drawing.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Operate in freehand mode for lines,
|
||||
* polygons, and circles. This makes the interaction always operate in freehand
|
||||
* mode and takes precedence over any `freehandCondition` option.
|
||||
*/
|
||||
freehand?: boolean | undefined;
|
||||
/**
|
||||
* Condition that activates freehand drawing for lines and polygons. This
|
||||
* function takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and
|
||||
* returns a boolean to indicate whether that event should be handled. The
|
||||
* default is {@link module :ol/events/condition.shiftKeyOnly}, meaning that the
|
||||
* Shift key activates freehand drawing.
|
||||
*/
|
||||
freehandCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Wrap the world horizontally on the sketch
|
||||
* overlay.
|
||||
*/
|
||||
wrapX?: boolean | undefined;
|
||||
/**
|
||||
* Layout of the
|
||||
* feature geometries created by the draw interaction.
|
||||
*/
|
||||
geometryLayout?: {
|
||||
XY: string;
|
||||
XYZ: string;
|
||||
XYM: string;
|
||||
XYZM: string;
|
||||
} | undefined;
|
||||
};
|
||||
/**
|
||||
* Coordinate type when drawing points.
|
||||
*/
|
||||
export type PointCoordType = import("../coordinate.js").Coordinate;
|
||||
/**
|
||||
* Coordinate type when drawing lines.
|
||||
*/
|
||||
export type LineCoordType = Array<import("../coordinate.js").Coordinate>;
|
||||
/**
|
||||
* Coordinate type when drawing polygons.
|
||||
*/
|
||||
export type PolyCoordType = Array<Array<import("../coordinate.js").Coordinate>>;
|
||||
/**
|
||||
* Types used for drawing coordinates.
|
||||
*/
|
||||
export type SketchCoordType = number[] | LineCoordType | PolyCoordType;
|
||||
/**
|
||||
* Function that takes an array of coordinates and an optional existing geometry
|
||||
* and a projection as arguments, and returns a geometry. The optional existing
|
||||
* geometry is the geometry that is returned when the function is called without
|
||||
* a second argument.
|
||||
*/
|
||||
export type GeometryFunction = (arg0: SketchCoordType, arg1: import("../geom/SimpleGeometry.js").default, arg2: import("../proj/Projection.js").default) => import("../geom/SimpleGeometry.js").default;
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type DrawOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'drawabort' | 'drawend' | 'drawstart', DrawEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'drawabort' | 'drawend' | 'drawstart', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
import Feature from "../Feature.js";
|
||||
type DrawEventType = string;
|
||||
declare namespace DrawEventType {
|
||||
const DRAWSTART: string;
|
||||
const DRAWEND: string;
|
||||
const DRAWABORT: string;
|
||||
}
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'drawabort'|'drawend'|'drawstart', Return>} DrawOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for drawing feature geometries.
|
||||
*
|
||||
* @fires DrawEvent
|
||||
* @api
|
||||
*/
|
||||
declare class Draw extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options: Options);
|
||||
/***
|
||||
* @type {DrawOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: DrawOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DrawOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: DrawOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {DrawOnSignature<void>}
|
||||
*/
|
||||
un: DrawOnSignature<void>;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private shouldHandle_;
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
* @private
|
||||
*/
|
||||
private downPx_;
|
||||
/**
|
||||
* @type {?}
|
||||
* @private
|
||||
*/
|
||||
private downTimeout_;
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
* @private
|
||||
*/
|
||||
private lastDragTime_;
|
||||
/**
|
||||
* Pointer type of the last pointermove event
|
||||
* @type {string}
|
||||
* @private
|
||||
*/
|
||||
private pointerType_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private freehand_;
|
||||
/**
|
||||
* Target source for drawn features.
|
||||
* @type {VectorSource|null}
|
||||
* @private
|
||||
*/
|
||||
private source_;
|
||||
/**
|
||||
* Target collection for drawn features.
|
||||
* @type {import("../Collection.js").default<Feature>|null}
|
||||
* @private
|
||||
*/
|
||||
private features_;
|
||||
/**
|
||||
* Pixel distance for snapping.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private snapTolerance_;
|
||||
/**
|
||||
* Geometry type.
|
||||
* @type {import("../geom/Geometry.js").Type}
|
||||
* @private
|
||||
*/
|
||||
private type_;
|
||||
/**
|
||||
* Drawing mode (derived from geometry type.
|
||||
* @type {Mode}
|
||||
* @private
|
||||
*/
|
||||
private mode_;
|
||||
/**
|
||||
* Stop click, singleclick, and doubleclick events from firing during drawing.
|
||||
* Default is `false`.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private stopClick_;
|
||||
/**
|
||||
* The number of points that must be drawn before a polygon ring or line
|
||||
* string can be finished. The default is 3 for polygon rings and 2 for
|
||||
* line strings.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private minPoints_;
|
||||
/**
|
||||
* The number of points that can be drawn before a polygon ring or line string
|
||||
* is finished. The default is no restriction.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private maxPoints_;
|
||||
/**
|
||||
* A function to decide if a potential finish coordinate is permissible
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private finishCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../geom/GeometryLayout").default}
|
||||
*/
|
||||
private geometryLayout_;
|
||||
/**
|
||||
* @type {GeometryFunction}
|
||||
* @private
|
||||
*/
|
||||
private geometryFunction_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private dragVertexDelay_;
|
||||
/**
|
||||
* Finish coordinate for the feature (first point for polygons, last point for
|
||||
* linestrings).
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
private finishCoordinate_;
|
||||
/**
|
||||
* Sketch feature.
|
||||
* @type {Feature<import('../geom/SimpleGeometry.js').default>}
|
||||
* @private
|
||||
*/
|
||||
private sketchFeature_;
|
||||
/**
|
||||
* Sketch point.
|
||||
* @type {Feature<Point>}
|
||||
* @private
|
||||
*/
|
||||
private sketchPoint_;
|
||||
/**
|
||||
* Sketch coordinates. Used when drawing a line or polygon.
|
||||
* @type {SketchCoordType}
|
||||
* @private
|
||||
*/
|
||||
private sketchCoords_;
|
||||
/**
|
||||
* Sketch line. Used when drawing polygon.
|
||||
* @type {Feature<LineString>}
|
||||
* @private
|
||||
*/
|
||||
private sketchLine_;
|
||||
/**
|
||||
* Sketch line coordinates. Used when drawing a polygon or circle.
|
||||
* @type {LineCoordType}
|
||||
* @private
|
||||
*/
|
||||
private sketchLineCoords_;
|
||||
/**
|
||||
* Squared tolerance for handling up events. If the squared distance
|
||||
* between a down and up event is greater than this tolerance, up events
|
||||
* will not be handled.
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private squaredClickTolerance_;
|
||||
/**
|
||||
* Draw overlay where our sketch features are drawn.
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
private overlay_;
|
||||
/**
|
||||
* Name of the geometry attribute for newly created features.
|
||||
* @type {string|undefined}
|
||||
* @private
|
||||
*/
|
||||
private geometryName_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private freehandCondition_;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* Get the overlay layer that this interaction renders sketch features to.
|
||||
* @return {VectorLayer} Overlay layer.
|
||||
* @api
|
||||
*/
|
||||
getOverlay(): VectorLayer<any>;
|
||||
/**
|
||||
* Handle move events.
|
||||
* @param {import("../MapBrowserEvent.js").default} event A move event.
|
||||
* @private
|
||||
*/
|
||||
private handlePointerMove_;
|
||||
/**
|
||||
* Determine if an event is within the snapping tolerance of the start coord.
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel.
|
||||
* @return {boolean} The event is within the snapping tolerance of the start.
|
||||
* @private
|
||||
*/
|
||||
private atFinish_;
|
||||
/**
|
||||
* @param {import("../coordinate").Coordinate} coordinates Coordinate.
|
||||
* @private
|
||||
*/
|
||||
private createOrUpdateSketchPoint_;
|
||||
/**
|
||||
* @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
|
||||
* @private
|
||||
*/
|
||||
private createOrUpdateCustomSketchLine_;
|
||||
/**
|
||||
* Start the drawing.
|
||||
* @param {import("../coordinate.js").Coordinate} start Start coordinate.
|
||||
* @private
|
||||
*/
|
||||
private startDrawing_;
|
||||
/**
|
||||
* Modify the drawing.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @private
|
||||
*/
|
||||
private modifyDrawing_;
|
||||
/**
|
||||
* Add a new coordinate to the drawing.
|
||||
* @param {!PointCoordType} coordinate Coordinate
|
||||
* @private
|
||||
*/
|
||||
private addToDrawing_;
|
||||
/**
|
||||
* Remove last point of the feature currently being drawn. Does not do anything when
|
||||
* drawing POINT or MULTI_POINT geometries.
|
||||
* @api
|
||||
*/
|
||||
removeLastPoint(): void;
|
||||
/**
|
||||
* Stop drawing and add the sketch feature to the target layer.
|
||||
* The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
|
||||
* dispatched before inserting the feature.
|
||||
* @api
|
||||
*/
|
||||
finishDrawing(): void;
|
||||
/**
|
||||
* Stop drawing without adding the sketch feature to the target layer.
|
||||
* @return {Feature<import("../geom/SimpleGeometry.js").default>|null} The sketch feature (or null if none).
|
||||
* @private
|
||||
*/
|
||||
private abortDrawing_;
|
||||
/**
|
||||
* Stop drawing without adding the sketch feature to the target layer.
|
||||
* @api
|
||||
*/
|
||||
abortDrawing(): void;
|
||||
/**
|
||||
* Append coordinates to the end of the geometry that is currently being drawn.
|
||||
* This can be used when drawing LineStrings or Polygons. Coordinates will
|
||||
* either be appended to the current LineString or the outer ring of the current
|
||||
* Polygon. If no geometry is being drawn, a new one will be created.
|
||||
* @param {!LineCoordType} coordinates Linear coordinates to be appended to
|
||||
* the coordinate array.
|
||||
* @api
|
||||
*/
|
||||
appendCoordinates(coordinates: LineCoordType): void;
|
||||
/**
|
||||
* Initiate draw mode by starting from an existing geometry which will
|
||||
* receive new additional points. This only works on features with
|
||||
* `LineString` geometries, where the interaction will extend lines by adding
|
||||
* points to the end of the coordinates array.
|
||||
* This will change the original feature, instead of drawing a copy.
|
||||
*
|
||||
* The function will dispatch a `drawstart` event.
|
||||
*
|
||||
* @param {!Feature<LineString>} feature Feature to be extended.
|
||||
* @api
|
||||
*/
|
||||
extend(feature: Feature<LineString>): void;
|
||||
/**
|
||||
* Redraw the sketch features.
|
||||
* @private
|
||||
*/
|
||||
private updateSketchFeatures_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private updateState_;
|
||||
}
|
||||
import VectorSource from "../source/Vector.js";
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
import VectorLayer from "../layer/Vector.js";
|
||||
import LineString from "../geom/LineString.js";
|
||||
//# sourceMappingURL=Draw.d.ts.map
|
||||
1
node_modules/ol/interaction/Draw.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Draw.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Draw.d.ts","sourceRoot":"","sources":["../src/interaction/Draw.js"],"names":[],"mappings":"AAiqCA;;;;;;;;;;;;GAYG;AACH,sGAHY,gBAAgB,CAgC3B;AAED;;;;;;GAMG;AACH,6BAHY,gBAAgB,CAkC3B;AAxlCD;;;;GAIG;AACH;IACE;;;OAGG;IACH,kBAHW,aAAa,WACb,OAAO,EAWjB;IANC;;;;OAIG;IACH,SAHU,OAAO,CAGK;CAEzB;;;;;;;UA3Ia,OAAO,qBAAqB,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAuDnC,OAAO,kBAAkB,EAAE,UAAU;;;;4BAKrC,MAAM,OAAO,kBAAkB,EAAE,UAAU,CAAC;;;;4BAK5C,MAAM,MAAM,OAAO,kBAAkB,EAAE,UAAU,CAAC,CAAC;;;;8BAKnD,wCAA0C;;;;;;;sCAQhC,eAAe,QAAE,OAAO,2BAA2B,EAAE,OAAO,QAClF,OAAa,uBAAuB,EAAE,OAAO,KAC7C,OAAa,2BAA2B,EAAE,OAAO;;;;sCA+DrC,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACjI,OAAW,eAAe,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H,uBAA0B;IAE1B;;;;OAIG;IACH,qBAAwB;IAExB;;;;OAIG;IACH,sBAAyB;IAEzB;;;;OAIG;IACH,oBAAuB;IAEvB;;;;OAIG;IACH,0BAA6B;IAE7B;;;;;;OAMG;IACH,+BAEM;IAEN;;;;OAIG;IACH,iBAOE;IAEF;;;;OAIG;IACH,sBAAyC;IAEzC;;;OAGG;IACH,mBAAwE;IAExE;;;OAGG;IACH,2BAAuB;IAYzB;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAK9C;IAED;;;;OAIG;IACH,+BAEC;IA0JD;;;;OAIG;IACH,2BAyBC;IAED;;;;;OAKG;IACH,kBAqCC;IAED;;;OAGG;IACH,mCAQC;IAED;;;OAGG;IACH,wCAmBC;IAED;;;;OAIG;IACH,sBAgCC;IAED;;;;OAIG;IACH,uBAwCC;IAED;;;;OAIG;IACH,sBAsCC;IAED;;;;OAIG;IACH,wBAuCC;IAED;;;;;OAKG;IACH,sBA4CC;IAED;;;;OAIG;IACH,sBAQC;IAED;;;OAGG;IACH,qBAKC;IAED;;;;;;;;OAQG;IACH,oDAmCC;IAED;;;;;;;;;;;OAWG;IACH,gBAHY,QAAQ,UAAU,CAAC,QAgB9B;IAED;;;OAGG;IACH,8BAcC;IAED;;OAEG;IACH,qBAOC;CACF"}
|
||||
1195
node_modules/ol/interaction/Draw.js
generated
vendored
Normal file
1195
node_modules/ol/interaction/Draw.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/ol/interaction/Draw.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Draw.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
201
node_modules/ol/interaction/Extent.d.ts
generated
vendored
Normal file
201
node_modules/ol/interaction/Extent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Extent~Extent} instances are
|
||||
* instances of this type.
|
||||
*/
|
||||
export class ExtentEvent extends Event {
|
||||
/**
|
||||
* @param {import("../extent.js").Extent} extent the new extent
|
||||
*/
|
||||
constructor(extent: import("../extent.js").Extent);
|
||||
/**
|
||||
* The current extent.
|
||||
* @type {import("../extent.js").Extent}
|
||||
* @api
|
||||
*/
|
||||
extent: import("../extent.js").Extent;
|
||||
}
|
||||
export default Extent;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.always}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Initial extent. Defaults to no
|
||||
* initial extent.
|
||||
*/
|
||||
extent?: import("../extent.js").Extent | undefined;
|
||||
/**
|
||||
* Style for the drawn extent box. Defaults to the `Polygon` editing style
|
||||
* documented in {@link module :ol/style/Style~Style}
|
||||
*/
|
||||
boxStyle?: import("../style/Style.js").StyleLike | undefined;
|
||||
/**
|
||||
* Pixel tolerance for considering the
|
||||
* pointer close enough to a segment or vertex for editing.
|
||||
*/
|
||||
pixelTolerance?: number | undefined;
|
||||
/**
|
||||
* Style for the cursor used to draw the extent. Defaults to the `Point` editing style
|
||||
* documented in {@link module :ol/style/Style~Style}
|
||||
*/
|
||||
pointerStyle?: import("../style/Style.js").StyleLike | undefined;
|
||||
/**
|
||||
* Wrap the drawn extent across multiple maps
|
||||
* in the X direction? Only affects visuals, not functionality.
|
||||
*/
|
||||
wrapX?: boolean | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type ExtentOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'extentchanged', ExtentEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'extentchanged', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'extentchanged', ExtentEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'extentchanged', Return>} ExtentOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map.
|
||||
* Once drawn, the vector box can be modified by dragging its vertices or edges.
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* @fires ExtentEvent
|
||||
* @api
|
||||
*/
|
||||
declare class Extent extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {ExtentOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: ExtentOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ExtentOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: ExtentOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ExtentOnSignature<void>}
|
||||
*/
|
||||
un: ExtentOnSignature<void>;
|
||||
/**
|
||||
* Condition
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
* @private
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* Extent of the drawn box
|
||||
* @type {import("../extent.js").Extent}
|
||||
* @private
|
||||
*/
|
||||
private extent_;
|
||||
/**
|
||||
* Handler for pointer move events
|
||||
* @type {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null}
|
||||
* @private
|
||||
*/
|
||||
private pointerHandler_;
|
||||
/**
|
||||
* Pixel threshold to snap to extent
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private pixelTolerance_;
|
||||
/**
|
||||
* Is the pointer snapped to an extent vertex
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private snappedToVertex_;
|
||||
/**
|
||||
* Feature for displaying the visible extent
|
||||
* @type {Feature}
|
||||
* @private
|
||||
*/
|
||||
private extentFeature_;
|
||||
/**
|
||||
* Feature for displaying the visible pointer
|
||||
* @type {Feature<Point>}
|
||||
* @private
|
||||
*/
|
||||
private vertexFeature_;
|
||||
/**
|
||||
* Layer for the extentFeature
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
private extentOverlay_;
|
||||
/**
|
||||
* Layer for the vertexFeature
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
private vertexOverlay_;
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel cursor location
|
||||
* @param {import("../PluggableMap.js").default} map map
|
||||
* @return {import("../coordinate.js").Coordinate|null} snapped vertex on extent
|
||||
* @private
|
||||
*/
|
||||
private snapToVertex_;
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event
|
||||
* @private
|
||||
*/
|
||||
private handlePointerMove_;
|
||||
/**
|
||||
* @param {import("../extent.js").Extent} extent extent
|
||||
* @return {Feature} extent as featrue
|
||||
* @private
|
||||
*/
|
||||
private createOrUpdateExtentFeature_;
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} vertex location of feature
|
||||
* @return {Feature} vertex as feature
|
||||
* @private
|
||||
*/
|
||||
private createOrUpdatePointerFeature_;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* Returns the current drawn extent in the view projection (or user projection if set)
|
||||
*
|
||||
* @return {import("../extent.js").Extent} Drawn extent in the view projection.
|
||||
* @api
|
||||
*/
|
||||
getExtent(): import("../extent.js").Extent;
|
||||
/**
|
||||
* Returns the current drawn extent in the view projection
|
||||
*
|
||||
* @return {import("../extent.js").Extent} Drawn extent in the view projection.
|
||||
* @api
|
||||
*/
|
||||
getExtentInternal(): import("../extent.js").Extent;
|
||||
/**
|
||||
* Manually sets the drawn extent, using the view projection.
|
||||
*
|
||||
* @param {import("../extent.js").Extent} extent Extent
|
||||
* @api
|
||||
*/
|
||||
setExtent(extent: import("../extent.js").Extent): void;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=Extent.d.ts.map
|
||||
1
node_modules/ol/interaction/Extent.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Extent.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Extent.d.ts","sourceRoot":"","sources":["../src/interaction/Extent.js"],"names":[],"mappings":"AAsDA;;;;GAIG;AACH;IACE;;OAEG;IACH,oBAFW,OAAO,cAAc,EAAE,MAAM,EAWvC;IANC;;;;OAIG;IACH,QAHU,OAAO,cAAc,EAAE,MAAM,CAGnB;CAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAIY,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,eAAqB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC/D,OAAW,eAAe,EAAE,WAAW,CAAC,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,GAC7E,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GAAC,OAAO,oBAAoB,EAAE,KAAK,GACrH,eAAqB,GAAC,eAAe,EAAE,MAAM,CAAC;;AAP/C;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,+CA+GC;IA1GC;;OAEG;IACH,IAFU,kBAAkB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEnD;IAEP;;OAEG;IACH,MAFU,kBAAkB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEjD;IAET;;OAEG;IACH,IAFU,kBAAkB,IAAI,CAAC,CAE1B;IAEP;;;;OAIG;IACH,mBAAgE;IAEhE;;;;OAIG;IACH,gBAAmB;IAEnB;;;;OAIG;IACH,wBAA2B;IAE3B;;;;OAIG;IACH,wBACoE;IAEpE;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,uBAA0B;IAE1B;;;;OAIG;IACH,uBAA0B;IAM1B;;;;OAIG;IACH,uBAUE;IAEF;;;;OAIG;IACH,uBAUE;IAOJ;;;;;OAKG;IACH,sBAmCC;IAED;;;OAGG;IACH,2BASC;IAED;;;;OAIG;IACH,qCAmBC;IAED;;;;OAIG;IACH,sCAWC;IA+GD;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAM9C;IAED;;;;;OAKG;IACH,aAHY,OAAO,cAAc,EAAE,MAAM,CAQxC;IAED;;;;;OAKG;IACH,qBAHY,OAAO,cAAc,EAAE,MAAM,CAKxC;IAED;;;;;OAKG;IACH,kBAHW,OAAO,cAAc,EAAE,MAAM,QAQvC;CACF"}
|
||||
519
node_modules/ol/interaction/Extent.js
generated
vendored
Normal file
519
node_modules/ol/interaction/Extent.js
generated
vendored
Normal file
@@ -0,0 +1,519 @@
|
||||
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/interaction/Extent
|
||||
*/
|
||||
import Event from '../events/Event.js';
|
||||
import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import VectorLayer from '../layer/Vector.js';
|
||||
import VectorSource from '../source/Vector.js';
|
||||
import { always } from '../events/condition.js';
|
||||
import { boundingExtent, getArea } from '../extent.js';
|
||||
import { closestOnSegment, distance as coordinateDistance, squaredDistance as squaredCoordinateDistance, squaredDistanceToSegment, } from '../coordinate.js';
|
||||
import { createEditingStyle } from '../style/Style.js';
|
||||
import { fromExtent as polygonFromExtent } from '../geom/Polygon.js';
|
||||
import { toUserExtent } from '../proj.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.always}.
|
||||
* @property {import("../extent.js").Extent} [extent] Initial extent. Defaults to no
|
||||
* initial extent.
|
||||
* @property {import("../style/Style.js").StyleLike} [boxStyle]
|
||||
* Style for the drawn extent box. Defaults to the `Polygon` editing style
|
||||
* documented in {@link module:ol/style/Style~Style}
|
||||
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
|
||||
* pointer close enough to a segment or vertex for editing.
|
||||
* @property {import("../style/Style.js").StyleLike} [pointerStyle]
|
||||
* Style for the cursor used to draw the extent. Defaults to the `Point` editing style
|
||||
* documented in {@link module:ol/style/Style~Style}
|
||||
* @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
|
||||
* in the X direction? Only affects visuals, not functionality.
|
||||
*/
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var ExtentEventType = {
|
||||
/**
|
||||
* Triggered after the extent is changed
|
||||
* @event ExtentEvent#extentchanged
|
||||
* @api
|
||||
*/
|
||||
EXTENTCHANGED: 'extentchanged',
|
||||
};
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Extent~Extent} instances are
|
||||
* instances of this type.
|
||||
*/
|
||||
var ExtentEvent = /** @class */ (function (_super) {
|
||||
__extends(ExtentEvent, _super);
|
||||
/**
|
||||
* @param {import("../extent.js").Extent} extent the new extent
|
||||
*/
|
||||
function ExtentEvent(extent) {
|
||||
var _this = _super.call(this, ExtentEventType.EXTENTCHANGED) || this;
|
||||
/**
|
||||
* The current extent.
|
||||
* @type {import("../extent.js").Extent}
|
||||
* @api
|
||||
*/
|
||||
_this.extent = extent;
|
||||
return _this;
|
||||
}
|
||||
return ExtentEvent;
|
||||
}(Event));
|
||||
export { ExtentEvent };
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'extentchanged', ExtentEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'extentchanged', Return>} ExtentOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to draw a vector box by clicking and dragging on the map.
|
||||
* Once drawn, the vector box can be modified by dragging its vertices or edges.
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* @fires ExtentEvent
|
||||
* @api
|
||||
*/
|
||||
var Extent = /** @class */ (function (_super) {
|
||||
__extends(Extent, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Extent(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options || {};
|
||||
_this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
|
||||
/***
|
||||
* @type {ExtentOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {ExtentOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {ExtentOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
/**
|
||||
* Condition
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
* @private
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : always;
|
||||
/**
|
||||
* Extent of the drawn box
|
||||
* @type {import("../extent.js").Extent}
|
||||
* @private
|
||||
*/
|
||||
_this.extent_ = null;
|
||||
/**
|
||||
* Handler for pointer move events
|
||||
* @type {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null}
|
||||
* @private
|
||||
*/
|
||||
_this.pointerHandler_ = null;
|
||||
/**
|
||||
* Pixel threshold to snap to extent
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.pixelTolerance_ =
|
||||
options.pixelTolerance !== undefined ? options.pixelTolerance : 10;
|
||||
/**
|
||||
* Is the pointer snapped to an extent vertex
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
_this.snappedToVertex_ = false;
|
||||
/**
|
||||
* Feature for displaying the visible extent
|
||||
* @type {Feature}
|
||||
* @private
|
||||
*/
|
||||
_this.extentFeature_ = null;
|
||||
/**
|
||||
* Feature for displaying the visible pointer
|
||||
* @type {Feature<Point>}
|
||||
* @private
|
||||
*/
|
||||
_this.vertexFeature_ = null;
|
||||
if (!opt_options) {
|
||||
opt_options = {};
|
||||
}
|
||||
/**
|
||||
* Layer for the extentFeature
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
_this.extentOverlay_ = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
useSpatialIndex: false,
|
||||
wrapX: !!opt_options.wrapX,
|
||||
}),
|
||||
style: opt_options.boxStyle
|
||||
? opt_options.boxStyle
|
||||
: getDefaultExtentStyleFunction(),
|
||||
updateWhileAnimating: true,
|
||||
updateWhileInteracting: true,
|
||||
});
|
||||
/**
|
||||
* Layer for the vertexFeature
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
_this.vertexOverlay_ = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
useSpatialIndex: false,
|
||||
wrapX: !!opt_options.wrapX,
|
||||
}),
|
||||
style: opt_options.pointerStyle
|
||||
? opt_options.pointerStyle
|
||||
: getDefaultPointerStyleFunction(),
|
||||
updateWhileAnimating: true,
|
||||
updateWhileInteracting: true,
|
||||
});
|
||||
if (opt_options.extent) {
|
||||
_this.setExtent(opt_options.extent);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel cursor location
|
||||
* @param {import("../PluggableMap.js").default} map map
|
||||
* @return {import("../coordinate.js").Coordinate|null} snapped vertex on extent
|
||||
* @private
|
||||
*/
|
||||
Extent.prototype.snapToVertex_ = function (pixel, map) {
|
||||
var pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);
|
||||
var sortByDistance = function (a, b) {
|
||||
return (squaredDistanceToSegment(pixelCoordinate, a) -
|
||||
squaredDistanceToSegment(pixelCoordinate, b));
|
||||
};
|
||||
var extent = this.getExtentInternal();
|
||||
if (extent) {
|
||||
//convert extents to line segments and find the segment closest to pixelCoordinate
|
||||
var segments = getSegments(extent);
|
||||
segments.sort(sortByDistance);
|
||||
var closestSegment = segments[0];
|
||||
var vertex = closestOnSegment(pixelCoordinate, closestSegment);
|
||||
var vertexPixel = map.getPixelFromCoordinateInternal(vertex);
|
||||
//if the distance is within tolerance, snap to the segment
|
||||
if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {
|
||||
//test if we should further snap to a vertex
|
||||
var pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);
|
||||
var pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);
|
||||
var squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);
|
||||
var squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);
|
||||
var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
||||
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
||||
if (this.snappedToVertex_) {
|
||||
vertex =
|
||||
squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];
|
||||
}
|
||||
return vertex;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event
|
||||
* @private
|
||||
*/
|
||||
Extent.prototype.handlePointerMove_ = function (mapBrowserEvent) {
|
||||
var pixel = mapBrowserEvent.pixel;
|
||||
var map = mapBrowserEvent.map;
|
||||
var vertex = this.snapToVertex_(pixel, map);
|
||||
if (!vertex) {
|
||||
vertex = map.getCoordinateFromPixelInternal(pixel);
|
||||
}
|
||||
this.createOrUpdatePointerFeature_(vertex);
|
||||
};
|
||||
/**
|
||||
* @param {import("../extent.js").Extent} extent extent
|
||||
* @return {Feature} extent as featrue
|
||||
* @private
|
||||
*/
|
||||
Extent.prototype.createOrUpdateExtentFeature_ = function (extent) {
|
||||
var extentFeature = this.extentFeature_;
|
||||
if (!extentFeature) {
|
||||
if (!extent) {
|
||||
extentFeature = new Feature({});
|
||||
}
|
||||
else {
|
||||
extentFeature = new Feature(polygonFromExtent(extent));
|
||||
}
|
||||
this.extentFeature_ = extentFeature;
|
||||
this.extentOverlay_.getSource().addFeature(extentFeature);
|
||||
}
|
||||
else {
|
||||
if (!extent) {
|
||||
extentFeature.setGeometry(undefined);
|
||||
}
|
||||
else {
|
||||
extentFeature.setGeometry(polygonFromExtent(extent));
|
||||
}
|
||||
}
|
||||
return extentFeature;
|
||||
};
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} vertex location of feature
|
||||
* @return {Feature} vertex as feature
|
||||
* @private
|
||||
*/
|
||||
Extent.prototype.createOrUpdatePointerFeature_ = function (vertex) {
|
||||
var vertexFeature = this.vertexFeature_;
|
||||
if (!vertexFeature) {
|
||||
vertexFeature = new Feature(new Point(vertex));
|
||||
this.vertexFeature_ = vertexFeature;
|
||||
this.vertexOverlay_.getSource().addFeature(vertexFeature);
|
||||
}
|
||||
else {
|
||||
var geometry = vertexFeature.getGeometry();
|
||||
geometry.setCoordinates(vertex);
|
||||
}
|
||||
return vertexFeature;
|
||||
};
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
Extent.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
if (!mapBrowserEvent.originalEvent || !this.condition_(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
//display pointer (if not dragging)
|
||||
if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&
|
||||
!this.handlingDownUpSequence) {
|
||||
this.handlePointerMove_(mapBrowserEvent);
|
||||
}
|
||||
//call pointer to determine up/down/drag
|
||||
_super.prototype.handleEvent.call(this, mapBrowserEvent);
|
||||
//return false to stop propagation
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
Extent.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
var pixel = mapBrowserEvent.pixel;
|
||||
var map = mapBrowserEvent.map;
|
||||
var extent = this.getExtentInternal();
|
||||
var vertex = this.snapToVertex_(pixel, map);
|
||||
//find the extent corner opposite the passed corner
|
||||
var getOpposingPoint = function (point) {
|
||||
var x_ = null;
|
||||
var y_ = null;
|
||||
if (point[0] == extent[0]) {
|
||||
x_ = extent[2];
|
||||
}
|
||||
else if (point[0] == extent[2]) {
|
||||
x_ = extent[0];
|
||||
}
|
||||
if (point[1] == extent[1]) {
|
||||
y_ = extent[3];
|
||||
}
|
||||
else if (point[1] == extent[3]) {
|
||||
y_ = extent[1];
|
||||
}
|
||||
if (x_ !== null && y_ !== null) {
|
||||
return [x_, y_];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
if (vertex && extent) {
|
||||
var x = vertex[0] == extent[0] || vertex[0] == extent[2] ? vertex[0] : null;
|
||||
var y = vertex[1] == extent[1] || vertex[1] == extent[3] ? vertex[1] : null;
|
||||
//snap to point
|
||||
if (x !== null && y !== null) {
|
||||
this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));
|
||||
//snap to edge
|
||||
}
|
||||
else if (x !== null) {
|
||||
this.pointerHandler_ = getEdgeHandler(getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[3]]));
|
||||
}
|
||||
else if (y !== null) {
|
||||
this.pointerHandler_ = getEdgeHandler(getOpposingPoint([extent[0], y]), getOpposingPoint([extent[2], y]));
|
||||
}
|
||||
//no snap - new bbox
|
||||
}
|
||||
else {
|
||||
vertex = map.getCoordinateFromPixelInternal(pixel);
|
||||
this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);
|
||||
this.pointerHandler_ = getPointHandler(vertex);
|
||||
}
|
||||
return true; //event handled; start downup sequence
|
||||
};
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
Extent.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
if (this.pointerHandler_) {
|
||||
var pixelCoordinate = mapBrowserEvent.coordinate;
|
||||
this.setExtent(this.pointerHandler_(pixelCoordinate));
|
||||
this.createOrUpdatePointerFeature_(pixelCoordinate);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
Extent.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
this.pointerHandler_ = null;
|
||||
//If bbox is zero area, set to null;
|
||||
var extent = this.getExtentInternal();
|
||||
if (!extent || getArea(extent) === 0) {
|
||||
this.setExtent(null);
|
||||
}
|
||||
return false; //Stop handling downup sequence
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
Extent.prototype.setMap = function (map) {
|
||||
this.extentOverlay_.setMap(map);
|
||||
this.vertexOverlay_.setMap(map);
|
||||
_super.prototype.setMap.call(this, map);
|
||||
};
|
||||
/**
|
||||
* Returns the current drawn extent in the view projection (or user projection if set)
|
||||
*
|
||||
* @return {import("../extent.js").Extent} Drawn extent in the view projection.
|
||||
* @api
|
||||
*/
|
||||
Extent.prototype.getExtent = function () {
|
||||
return toUserExtent(this.getExtentInternal(), this.getMap().getView().getProjection());
|
||||
};
|
||||
/**
|
||||
* Returns the current drawn extent in the view projection
|
||||
*
|
||||
* @return {import("../extent.js").Extent} Drawn extent in the view projection.
|
||||
* @api
|
||||
*/
|
||||
Extent.prototype.getExtentInternal = function () {
|
||||
return this.extent_;
|
||||
};
|
||||
/**
|
||||
* Manually sets the drawn extent, using the view projection.
|
||||
*
|
||||
* @param {import("../extent.js").Extent} extent Extent
|
||||
* @api
|
||||
*/
|
||||
Extent.prototype.setExtent = function (extent) {
|
||||
//Null extent means no bbox
|
||||
this.extent_ = extent ? extent : null;
|
||||
this.createOrUpdateExtentFeature_(extent);
|
||||
this.dispatchEvent(new ExtentEvent(this.extent_));
|
||||
};
|
||||
return Extent;
|
||||
}(PointerInteraction));
|
||||
/**
|
||||
* Returns the default style for the drawn bbox
|
||||
*
|
||||
* @return {import("../style/Style.js").StyleFunction} Default Extent style
|
||||
*/
|
||||
function getDefaultExtentStyleFunction() {
|
||||
var style = createEditingStyle();
|
||||
return function (feature, resolution) {
|
||||
return style['Polygon'];
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the default style for the pointer
|
||||
*
|
||||
* @return {import("../style/Style.js").StyleFunction} Default pointer style
|
||||
*/
|
||||
function getDefaultPointerStyleFunction() {
|
||||
var style = createEditingStyle();
|
||||
return function (feature, resolution) {
|
||||
return style['Point'];
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} fixedPoint corner that will be unchanged in the new extent
|
||||
* @return {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} event handler
|
||||
*/
|
||||
function getPointHandler(fixedPoint) {
|
||||
return function (point) {
|
||||
return boundingExtent([fixedPoint, point]);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} fixedP1 first corner that will be unchanged in the new extent
|
||||
* @param {import("../coordinate.js").Coordinate} fixedP2 second corner that will be unchanged in the new extent
|
||||
* @return {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null} event handler
|
||||
*/
|
||||
function getEdgeHandler(fixedP1, fixedP2) {
|
||||
if (fixedP1[0] == fixedP2[0]) {
|
||||
return function (point) {
|
||||
return boundingExtent([fixedP1, [point[0], fixedP2[1]]]);
|
||||
};
|
||||
}
|
||||
else if (fixedP1[1] == fixedP2[1]) {
|
||||
return function (point) {
|
||||
return boundingExtent([fixedP1, [fixedP2[0], point[1]]]);
|
||||
};
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {import("../extent.js").Extent} extent extent
|
||||
* @return {Array<Array<import("../coordinate.js").Coordinate>>} extent line segments
|
||||
*/
|
||||
function getSegments(extent) {
|
||||
return [
|
||||
[
|
||||
[extent[0], extent[1]],
|
||||
[extent[0], extent[3]],
|
||||
],
|
||||
[
|
||||
[extent[0], extent[3]],
|
||||
[extent[2], extent[3]],
|
||||
],
|
||||
[
|
||||
[extent[2], extent[3]],
|
||||
[extent[2], extent[1]],
|
||||
],
|
||||
[
|
||||
[extent[2], extent[1]],
|
||||
[extent[0], extent[1]],
|
||||
],
|
||||
];
|
||||
}
|
||||
export default Extent;
|
||||
//# sourceMappingURL=Extent.js.map
|
||||
1
node_modules/ol/interaction/Extent.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Extent.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
121
node_modules/ol/interaction/Interaction.d.ts
generated
vendored
Normal file
121
node_modules/ol/interaction/Interaction.d.ts
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {import("../coordinate.js").Coordinate} delta Delta.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
*/
|
||||
export function pan(view: import("../View.js").default, delta: import("../coordinate.js").Coordinate, opt_duration?: number | undefined): void;
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {number} delta Delta from previous zoom level.
|
||||
* @param {import("../coordinate.js").Coordinate} [opt_anchor] Anchor coordinate in the user projection.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
*/
|
||||
export function zoomByDelta(view: import("../View.js").default, delta: number, opt_anchor?: import("../coordinate.js").Coordinate | undefined, opt_duration?: number | undefined): void;
|
||||
export default Interaction;
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type InteractionOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active', Return>;
|
||||
/**
|
||||
* Object literal with config options for interactions.
|
||||
*/
|
||||
export type InteractionOptions = {
|
||||
/**
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. If the function returns a falsy value, propagation of
|
||||
* the event to other interactions in the map's interactions chain will be
|
||||
* prevented (this includes functions with no explicit return). The interactions
|
||||
* are traversed in reverse order of the interactions collection of the map.
|
||||
*/
|
||||
handleEvent: (arg0: import("../MapBrowserEvent.js").default<any>) => boolean;
|
||||
};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active', Return>} InteractionOnSignature
|
||||
*/
|
||||
/**
|
||||
* Object literal with config options for interactions.
|
||||
* @typedef {Object} InteractionOptions
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. If the function returns a falsy value, propagation of
|
||||
* the event to other interactions in the map's interactions chain will be
|
||||
* prevented (this includes functions with no explicit return). The interactions
|
||||
* are traversed in reverse order of the interactions collection of the map.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
* instantiated in apps.
|
||||
* User actions that change the state of the map. Some are similar to controls,
|
||||
* but are not associated with a DOM element.
|
||||
* For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is
|
||||
* functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered
|
||||
* by a keyboard event not a button element event.
|
||||
* Although interactions do not have a DOM element, some of them do render
|
||||
* vectors and so are visible on the screen.
|
||||
* @api
|
||||
*/
|
||||
declare class Interaction extends BaseObject {
|
||||
/**
|
||||
* @param {InteractionOptions} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: InteractionOptions | undefined);
|
||||
/***
|
||||
* @type {InteractionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: InteractionOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {InteractionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: InteractionOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {InteractionOnSignature<void>}
|
||||
*/
|
||||
un: InteractionOnSignature<void>;
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @api
|
||||
*/
|
||||
handleEvent(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>): boolean;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../PluggableMap.js").default|null}
|
||||
*/
|
||||
private map_;
|
||||
/**
|
||||
* Return whether the interaction is currently active.
|
||||
* @return {boolean} `true` if the interaction is active, `false` otherwise.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
getActive(): boolean;
|
||||
/**
|
||||
* Get the map associated with this interaction.
|
||||
* @return {import("../PluggableMap.js").default|null} Map.
|
||||
* @api
|
||||
*/
|
||||
getMap(): import("../PluggableMap.js").default | null;
|
||||
/**
|
||||
* Activate or deactivate the interaction.
|
||||
* @param {boolean} active Active.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
setActive(active: boolean): void;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default | null): void;
|
||||
}
|
||||
import BaseObject from "../Object.js";
|
||||
//# sourceMappingURL=Interaction.d.ts.map
|
||||
1
node_modules/ol/interaction/Interaction.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Interaction.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Interaction.d.ts","sourceRoot":"","sources":["../src/interaction/Interaction.js"],"names":[],"mappings":"AA6HA;;;;GAIG;AACH,0BAJW,OAAO,YAAY,EAAE,OAAO,SAC5B,OAAO,kBAAkB,EAAE,UAAU,2CAa/C;AAED;;;;;GAKG;AACH,kCALW,OAAO,YAAY,EAAE,OAAO,SAC5B,MAAM,2GAuBhB;;;;;6CA9JY,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,eAAqB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC/D,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GAAC,OAAO,oBAAoB,EAAE,KAAK,GACrH,eAAqB,EAAE,MAAM,CAAC;;;;;;;;;;;;yEAMiC,OAAO;;AAZvE;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,0DA6BC;IA1BC;;OAEG;IACH,IAFU,uBAAuB,OAAO,WAAW,EAAE,SAAS,CAAC,CAExD;IAEP;;OAEG;IACH,MAFU,uBAAuB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEtD;IAET;;OAEG;IACH,IAFU,uBAAuB,IAAI,CAAC,CAE/B;IAkCT;;;;;OAKG;IACH,4EAHY,OAAO,CAKlB;IApCC;;;OAGG;IACH,aAAgB;IAKlB;;;;;OAKG;IACH,aAJY,OAAO,CAMlB;IAED;;;;OAIG;IACH,UAHY,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,CAKpD;IAYD;;;;;OAKG;IACH,kBAJW,OAAO,QAMjB;IAED;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,QAInD;CACF"}
|
||||
169
node_modules/ol/interaction/Interaction.js
generated
vendored
Normal file
169
node_modules/ol/interaction/Interaction.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
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/interaction/Interaction
|
||||
*/
|
||||
import BaseObject from '../Object.js';
|
||||
import InteractionProperty from './Property.js';
|
||||
import { easeOut, linear } from '../easing.js';
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active', Return>} InteractionOnSignature
|
||||
*/
|
||||
/**
|
||||
* Object literal with config options for interactions.
|
||||
* @typedef {Object} InteractionOptions
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. If the function returns a falsy value, propagation of
|
||||
* the event to other interactions in the map's interactions chain will be
|
||||
* prevented (this includes functions with no explicit return). The interactions
|
||||
* are traversed in reverse order of the interactions collection of the map.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Abstract base class; normally only used for creating subclasses and not
|
||||
* instantiated in apps.
|
||||
* User actions that change the state of the map. Some are similar to controls,
|
||||
* but are not associated with a DOM element.
|
||||
* For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is
|
||||
* functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered
|
||||
* by a keyboard event not a button element event.
|
||||
* Although interactions do not have a DOM element, some of them do render
|
||||
* vectors and so are visible on the screen.
|
||||
* @api
|
||||
*/
|
||||
var Interaction = /** @class */ (function (_super) {
|
||||
__extends(Interaction, _super);
|
||||
/**
|
||||
* @param {InteractionOptions} [opt_options] Options.
|
||||
*/
|
||||
function Interaction(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
/***
|
||||
* @type {InteractionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {InteractionOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {InteractionOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
if (opt_options && opt_options.handleEvent) {
|
||||
_this.handleEvent = opt_options.handleEvent;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../PluggableMap.js").default|null}
|
||||
*/
|
||||
_this.map_ = null;
|
||||
_this.setActive(true);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Return whether the interaction is currently active.
|
||||
* @return {boolean} `true` if the interaction is active, `false` otherwise.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
Interaction.prototype.getActive = function () {
|
||||
return /** @type {boolean} */ (this.get(InteractionProperty.ACTIVE));
|
||||
};
|
||||
/**
|
||||
* Get the map associated with this interaction.
|
||||
* @return {import("../PluggableMap.js").default|null} Map.
|
||||
* @api
|
||||
*/
|
||||
Interaction.prototype.getMap = function () {
|
||||
return this.map_;
|
||||
};
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @api
|
||||
*/
|
||||
Interaction.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Activate or deactivate the interaction.
|
||||
* @param {boolean} active Active.
|
||||
* @observable
|
||||
* @api
|
||||
*/
|
||||
Interaction.prototype.setActive = function (active) {
|
||||
this.set(InteractionProperty.ACTIVE, active);
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
*/
|
||||
Interaction.prototype.setMap = function (map) {
|
||||
this.map_ = map;
|
||||
};
|
||||
return Interaction;
|
||||
}(BaseObject));
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {import("../coordinate.js").Coordinate} delta Delta.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
*/
|
||||
export function pan(view, delta, opt_duration) {
|
||||
var currentCenter = view.getCenterInternal();
|
||||
if (currentCenter) {
|
||||
var center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
|
||||
view.animateInternal({
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
easing: linear,
|
||||
center: view.getConstrainedCenter(center),
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {number} delta Delta from previous zoom level.
|
||||
* @param {import("../coordinate.js").Coordinate} [opt_anchor] Anchor coordinate in the user projection.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
*/
|
||||
export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
|
||||
var currentZoom = view.getZoom();
|
||||
if (currentZoom === undefined) {
|
||||
return;
|
||||
}
|
||||
var newZoom = view.getConstrainedZoom(currentZoom + delta);
|
||||
var newResolution = view.getResolutionForZoom(newZoom);
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
view.animate({
|
||||
resolution: newResolution,
|
||||
anchor: opt_anchor,
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
export default Interaction;
|
||||
//# sourceMappingURL=Interaction.js.map
|
||||
1
node_modules/ol/interaction/Interaction.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Interaction.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Interaction.js","sourceRoot":"","sources":["../src/interaction/Interaction.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,mBAAmB,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AAE7C;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;GAYG;AACH;IAA0B,+BAAU;IAClC;;OAEG;IACH,qBAAY,WAAW;QAAvB,YACE,iBAAO,SA4BR;QA1BC;;WAEG;QACH,KAAI,CAAC,EAAE,CAAC;QAER;;WAEG;QACH,KAAI,CAAC,IAAI,CAAC;QAEV;;WAEG;QACH,KAAI,CAAC,EAAE,CAAC;QAER,IAAI,WAAW,IAAI,WAAW,CAAC,WAAW,EAAE;YAC1C,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;SAC5C;QAED;;;WAGG;QACH,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;;IACvB,CAAC;IAED;;;;;OAKG;IACH,+BAAS,GAAT;QACE,OAAO,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,4BAAM,GAAN;QACE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,iCAAW,GAAX,UAAY,eAAe;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;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AgB,EAAE,CAAC;KACzB;IACD,IAAI,CAAC,OAAO,CAAC;QACX,UAAU,EAAE,aAAa;QACzB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG;QACzD,MAAM,EAAE,OAAO;KAChB,CAAC,CAAC;AACL,CAAC;AAED,eAAe,WAAW,CAAC"}
|
||||
73
node_modules/ol/interaction/KeyboardPan.d.ts
generated
vendored
Normal file
73
node_modules/ol/interaction/KeyboardPan.d.ts
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
export default KeyboardPan;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module :ol/events/condition.noModifierKeys} and
|
||||
* {@link module :ol/events/condition.targetNotEditable}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* The amount of pixels to pan on each key
|
||||
* press.
|
||||
*/
|
||||
pixelDelta?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.noModifierKeys} and
|
||||
* {@link module:ol/events/condition.targetNotEditable}.
|
||||
* @property {number} [duration=100] Animation duration in milliseconds.
|
||||
* @property {number} [pixelDelta=128] The amount of pixels to pan on each key
|
||||
* press.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to pan the map using keyboard arrows.
|
||||
* Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which
|
||||
* the keyboard events are attached. By default, this is the map div,
|
||||
* though you can change this with the `keyboardEventTarget` in
|
||||
* {@link module:ol/Map~Map}. `document` never loses focus but, for any other
|
||||
* element, focus will have to be on, and returned to, this element if the keys
|
||||
* are to function.
|
||||
* See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.
|
||||
* @api
|
||||
*/
|
||||
declare class KeyboardPan extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
private defaultCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private pixelDelta_;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=KeyboardPan.d.ts.map
|
||||
1
node_modules/ol/interaction/KeyboardPan.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/KeyboardPan.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"KeyboardPan.d.ts","sourceRoot":"","sources":["../src/interaction/KeyboardPan.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AASA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,+CAqCC;IAhCC;;;;OAIG;IACH,0BAIC;IAED;;;OAGG;IACH,mBAG4B;IAE5B;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,oBAC6D;CAgDhE"}
|
||||
131
node_modules/ol/interaction/KeyboardPan.js
generated
vendored
Normal file
131
node_modules/ol/interaction/KeyboardPan.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
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/interaction/KeyboardPan
|
||||
*/
|
||||
import EventType from '../events/EventType.js';
|
||||
import Interaction, { pan } from './Interaction.js';
|
||||
import KeyCode from '../events/KeyCode.js';
|
||||
import { noModifierKeys, targetNotEditable } from '../events/condition.js';
|
||||
import { rotate as rotateCoordinate } from '../coordinate.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.noModifierKeys} and
|
||||
* {@link module:ol/events/condition.targetNotEditable}.
|
||||
* @property {number} [duration=100] Animation duration in milliseconds.
|
||||
* @property {number} [pixelDelta=128] The amount of pixels to pan on each key
|
||||
* press.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to pan the map using keyboard arrows.
|
||||
* Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which
|
||||
* the keyboard events are attached. By default, this is the map div,
|
||||
* though you can change this with the `keyboardEventTarget` in
|
||||
* {@link module:ol/Map~Map}. `document` never loses focus but, for any other
|
||||
* element, focus will have to be on, and returned to, this element if the keys
|
||||
* are to function.
|
||||
* See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.
|
||||
* @api
|
||||
*/
|
||||
var KeyboardPan = /** @class */ (function (_super) {
|
||||
__extends(KeyboardPan, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function KeyboardPan(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
_this.defaultCondition_ = function (mapBrowserEvent) {
|
||||
return (noModifierKeys(mapBrowserEvent) && targetNotEditable(mapBrowserEvent));
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ =
|
||||
options.condition !== undefined
|
||||
? options.condition
|
||||
: _this.defaultCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.pixelDelta_ =
|
||||
options.pixelDelta !== undefined ? options.pixelDelta : 128;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
|
||||
* `KeyEvent`, and decides the direction to pan to (if an arrow key was
|
||||
* pressed).
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @this {KeyboardPan}
|
||||
*/
|
||||
KeyboardPan.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == EventType.KEYDOWN) {
|
||||
var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
|
||||
var keyCode = keyEvent.keyCode;
|
||||
if (this.condition_(mapBrowserEvent) &&
|
||||
(keyCode == KeyCode.DOWN ||
|
||||
keyCode == KeyCode.LEFT ||
|
||||
keyCode == KeyCode.RIGHT ||
|
||||
keyCode == KeyCode.UP)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
var mapUnitsDelta = view.getResolution() * this.pixelDelta_;
|
||||
var deltaX = 0, deltaY = 0;
|
||||
if (keyCode == KeyCode.DOWN) {
|
||||
deltaY = -mapUnitsDelta;
|
||||
}
|
||||
else if (keyCode == KeyCode.LEFT) {
|
||||
deltaX = -mapUnitsDelta;
|
||||
}
|
||||
else if (keyCode == KeyCode.RIGHT) {
|
||||
deltaX = mapUnitsDelta;
|
||||
}
|
||||
else {
|
||||
deltaY = mapUnitsDelta;
|
||||
}
|
||||
var delta = [deltaX, deltaY];
|
||||
rotateCoordinate(delta, view.getRotation());
|
||||
pan(view, delta, this.duration_);
|
||||
keyEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
return KeyboardPan;
|
||||
}(Interaction));
|
||||
export default KeyboardPan;
|
||||
//# sourceMappingURL=KeyboardPan.js.map
|
||||
1
node_modules/ol/interaction/KeyboardPan.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/KeyboardPan.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"KeyboardPan.js","sourceRoot":"","sources":["../src/interaction/KeyboardPan.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,WAAW,EAAE,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,MAAM,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAE5D;;;;;;;;;;GAUG;AAEH;;;;;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AC,EACxB;gBACA,IAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;gBAChC,IAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;gBAC3B,IAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;gBAC9D,IAAI,MAAM,GAAG,CAAC,EACZ,MAAM,GAAG,CAAC,CAAC;gBACb,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE;oBAC3B,MAAM,GAAG,CAAC,aAAa,CAAC;iBACzB;qBAAM,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE;oBAClC,MAAM,GAAG,CAAC,aAAa,CAAC;iBACzB;qBAAM,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE;oBACnC,MAAM,GAAG,aAAa,CAAC;iBACxB;qBAAM;oBACL,MAAM,GAAG,aAAa,CAAC;iBACxB;gBACD,IAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC/B,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC5C,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;gBACjC,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC1B,SAAS,GAAG,IAAI,CAAC;aAClB;SACF;QACD,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC;IACH,kBAAC;AAAD,CAAC,AAxFD,CAA0B,WAAW,GAwFpC;AAED,eAAe,WAAW,CAAC"}
|
||||
63
node_modules/ol/interaction/KeyboardZoom.d.ts
generated
vendored
Normal file
63
node_modules/ol/interaction/KeyboardZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
export default KeyboardZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module :ol/events/condition.targetNotEditable}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* The zoom level delta on each key press.
|
||||
*/
|
||||
delta?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=100] Animation duration in milliseconds.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.targetNotEditable}.
|
||||
* @property {number} [delta=1] The zoom level delta on each key press.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map using keyboard + and -.
|
||||
* Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which
|
||||
* the keyboard events are attached. By default, this is the map div,
|
||||
* though you can change this with the `keyboardEventTarget` in
|
||||
* {@link module:ol/Map~Map}. `document` never loses focus but, for any other
|
||||
* element, focus will have to be on, and returned to, this element if the keys
|
||||
* are to function.
|
||||
* See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.
|
||||
* @api
|
||||
*/
|
||||
declare class KeyboardZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private delta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=KeyboardZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/KeyboardZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/KeyboardZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"KeyboardZoom.d.ts","sourceRoot":"","sources":["../src/interaction/KeyboardZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAOA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,+CAsBC;IAjBC;;;OAGG;IACH,mBAA2E;IAE3E;;;OAGG;IACH,eAA+C;IAE/C;;;OAGG;IACH,kBAAwE;CAoC3E"}
|
||||
98
node_modules/ol/interaction/KeyboardZoom.js
generated
vendored
Normal file
98
node_modules/ol/interaction/KeyboardZoom.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
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/interaction/KeyboardZoom
|
||||
*/
|
||||
import EventType from '../events/EventType.js';
|
||||
import Interaction, { zoomByDelta } from './Interaction.js';
|
||||
import { targetNotEditable } from '../events/condition.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=100] Animation duration in milliseconds.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.targetNotEditable}.
|
||||
* @property {number} [delta=1] The zoom level delta on each key press.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map using keyboard + and -.
|
||||
* Note that, although this interaction is by default included in maps,
|
||||
* the keys can only be used when browser focus is on the element to which
|
||||
* the keyboard events are attached. By default, this is the map div,
|
||||
* though you can change this with the `keyboardEventTarget` in
|
||||
* {@link module:ol/Map~Map}. `document` never loses focus but, for any other
|
||||
* element, focus will have to be on, and returned to, this element if the keys
|
||||
* are to function.
|
||||
* See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.
|
||||
* @api
|
||||
*/
|
||||
var KeyboardZoom = /** @class */ (function (_super) {
|
||||
__extends(KeyboardZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function KeyboardZoom(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : targetNotEditable;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.delta_ = options.delta ? options.delta : 1;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 100;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
|
||||
* `KeyEvent`, and decides whether to zoom in or out (depending on whether the
|
||||
* key pressed was '+' or '-').
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @this {KeyboardZoom}
|
||||
*/
|
||||
KeyboardZoom.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == EventType.KEYDOWN ||
|
||||
mapBrowserEvent.type == EventType.KEYPRESS) {
|
||||
var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
|
||||
var charCode = keyEvent.charCode;
|
||||
if (this.condition_(mapBrowserEvent) &&
|
||||
(charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var delta = charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_;
|
||||
var view = map.getView();
|
||||
zoomByDelta(view, delta, undefined, this.duration_);
|
||||
keyEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
return KeyboardZoom;
|
||||
}(Interaction));
|
||||
export default KeyboardZoom;
|
||||
//# sourceMappingURL=KeyboardZoom.js.map
|
||||
1
node_modules/ol/interaction/KeyboardZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/KeyboardZoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"KeyboardZoom.js","sourceRoot":"","sources":["../src/interaction/KeyboardZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,WAAW,EAAE,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;GAQG;AAEH;;;;;;;;;;;;GAYG;AACH;IAA2B,gCAAW;IACpC;;OAEG;IACH,sBAAY,WAAW;QAAvB,YACE,iBAAO,SAqBR;QAnBC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/C;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAE5E;;;WAGG;QAC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CAAC;IACH,mBAAC;AAAD,CAAC,AA7DD,CAA2B,WAAW,GA6DrC;AAED,eAAe,YAAY,CAAC"}
|
||||
114
node_modules/ol/interaction/Link.d.ts
generated
vendored
Normal file
114
node_modules/ol/interaction/Link.d.ts
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
export default Link;
|
||||
export type Options = {
|
||||
/**
|
||||
* Animate view transitions.
|
||||
*/
|
||||
animate?: boolean | import("../View.js").AnimationOptions | undefined;
|
||||
/**
|
||||
* Replace the current URL without creating the new entry in browser history.
|
||||
* By default, changes in the map state result in a new entry being added to the browser history.
|
||||
*/
|
||||
replace?: boolean | undefined;
|
||||
/**
|
||||
* By default, the URL will be updated with search parameters x, y, z, and r. To
|
||||
* avoid collisions with existing search parameters that your application uses, you can supply a custom prefix for
|
||||
* the ones used by this interaction (e.g. 'ol:').
|
||||
*/
|
||||
prefix?: string | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {boolean|import('../View.js').AnimationOptions} [animate=true] Animate view transitions.
|
||||
* @property {boolean} [replace=false] Replace the current URL without creating the new entry in browser history.
|
||||
* By default, changes in the map state result in a new entry being added to the browser history.
|
||||
* @property {string} [prefix=''] By default, the URL will be updated with search parameters x, y, z, and r. To
|
||||
* avoid collisions with existing search parameters that your application uses, you can supply a custom prefix for
|
||||
* the ones used by this interaction (e.g. 'ol:').
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* An interaction that synchronizes the map state with the URL.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Link extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Link options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {import('../View.js').AnimationOptions|null}
|
||||
* @private
|
||||
*/
|
||||
private animationOptions_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private replace_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
private prefix_;
|
||||
/**
|
||||
* @private
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
private listenerKeys_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private initial_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private updateState_;
|
||||
/**
|
||||
* @private
|
||||
* @param {string} name A parameter name.
|
||||
* @return {string} A name with the prefix applied.
|
||||
*/
|
||||
private getParamName_;
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
* @return {string|null} The parameter value.
|
||||
*/
|
||||
private get_;
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
* @param {string} value The param value.
|
||||
*/
|
||||
private set_;
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
*/
|
||||
private delete_;
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @private
|
||||
*/
|
||||
private registerListeners_;
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @private
|
||||
*/
|
||||
private unregisterListeners_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleChangeLayerGroup_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private updateUrl_;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=Link.d.ts.map
|
||||
1
node_modules/ol/interaction/Link.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Link.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../src/interaction/Link.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuDA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,+CAgDC;IA/BC;;;OAGG;IACH,0BAAyC;IAEzC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,sBAAuB;IAEvB;;;OAGG;IACH,iBAAoB;IAuHtB;;OAEG;IACH,qBAsEC;IA3LD;;;;OAIG;IACH,sBAKC;IAED;;;;;OAKG;IACH,aAEC;IAED;;;;;OAKG;IACH,aAEC;IAED;;;;OAIG;IACH,gBAEC;IAqBD;;;OAGG;IACH,2BAUC;IAED;;;OAGG;IACH,6BAkBC;IAED;;OAEG;IACH,gCASC;IA6ED;;OAEG;IACH,mBAsCC;CACF"}
|
||||
334
node_modules/ol/interaction/Link.js
generated
vendored
Normal file
334
node_modules/ol/interaction/Link.js
generated
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
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/interaction/Link
|
||||
*/
|
||||
import EventType from '../events/EventType.js';
|
||||
import Interaction from './Interaction.js';
|
||||
import MapEventType from '../MapEventType.js';
|
||||
import { assign } from '../obj.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
import { toFixed } from '../math.js';
|
||||
/**
|
||||
* @param {number} number A number.
|
||||
* @return {number} A number with at most 5 decimal places.
|
||||
*/
|
||||
function to5(number) {
|
||||
return toFixed(number, 5);
|
||||
}
|
||||
/**
|
||||
* @param {string} string A string.
|
||||
* @return {number} A number representing the string.
|
||||
*/
|
||||
function readNumber(string) {
|
||||
return parseFloat(string);
|
||||
}
|
||||
/**
|
||||
* @param {number} number A number.
|
||||
* @return {string} A string representing the number.
|
||||
*/
|
||||
function writeNumber(number) {
|
||||
return to5(number).toString();
|
||||
}
|
||||
/**
|
||||
* @param {number} a A number.
|
||||
* @param {number} b A number.
|
||||
* @return {boolean} The numbers are different.
|
||||
*/
|
||||
function differentNumber(a, b) {
|
||||
if (isNaN(a)) {
|
||||
return false;
|
||||
}
|
||||
return a !== readNumber(writeNumber(b));
|
||||
}
|
||||
/**
|
||||
* @param {Array<number>} a An array of two numbers.
|
||||
* @param {Array<number>} b An array of two numbers.
|
||||
* @return {boolean} The arrays are different.
|
||||
*/
|
||||
function differentArray(a, b) {
|
||||
return differentNumber(a[0], b[0]) || differentNumber(a[1], b[1]);
|
||||
}
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {boolean|import('../View.js').AnimationOptions} [animate=true] Animate view transitions.
|
||||
* @property {boolean} [replace=false] Replace the current URL without creating the new entry in browser history.
|
||||
* By default, changes in the map state result in a new entry being added to the browser history.
|
||||
* @property {string} [prefix=''] By default, the URL will be updated with search parameters x, y, z, and r. To
|
||||
* avoid collisions with existing search parameters that your application uses, you can supply a custom prefix for
|
||||
* the ones used by this interaction (e.g. 'ol:').
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* An interaction that synchronizes the map state with the URL.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Link = /** @class */ (function (_super) {
|
||||
__extends(Link, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Link options.
|
||||
*/
|
||||
function Link(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
var options = assign({ animate: true, replace: false, prefix: '' }, opt_options || {});
|
||||
var animationOptions;
|
||||
if (options.animate === true) {
|
||||
animationOptions = { duration: 250 };
|
||||
}
|
||||
else if (!options.animate) {
|
||||
animationOptions = null;
|
||||
}
|
||||
else {
|
||||
animationOptions = options.animate;
|
||||
}
|
||||
/**
|
||||
* @type {import('../View.js').AnimationOptions|null}
|
||||
* @private
|
||||
*/
|
||||
_this.animationOptions_ = animationOptions;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.replace_ = options.replace;
|
||||
/**
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
_this.prefix_ = options.prefix;
|
||||
/**
|
||||
* @private
|
||||
* @type {!Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
_this.listenerKeys_ = [];
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.initial_ = true;
|
||||
_this.updateState_ = _this.updateState_.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @param {string} name A parameter name.
|
||||
* @return {string} A name with the prefix applied.
|
||||
*/
|
||||
Link.prototype.getParamName_ = function (name) {
|
||||
if (!this.prefix_) {
|
||||
return name;
|
||||
}
|
||||
return this.prefix_ + name;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
* @return {string|null} The parameter value.
|
||||
*/
|
||||
Link.prototype.get_ = function (params, name) {
|
||||
return params.get(this.getParamName_(name));
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
* @param {string} value The param value.
|
||||
*/
|
||||
Link.prototype.set_ = function (params, name, value) {
|
||||
params.set(this.getParamName_(name), value);
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {URLSearchParams} params The search params.
|
||||
* @param {string} name The unprefixed parameter name.
|
||||
*/
|
||||
Link.prototype.delete_ = function (params, name) {
|
||||
params.delete(this.getParamName_(name));
|
||||
};
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
*/
|
||||
Link.prototype.setMap = function (map) {
|
||||
var oldMap = this.getMap();
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map === oldMap) {
|
||||
return;
|
||||
}
|
||||
if (oldMap) {
|
||||
this.unregisterListeners_(oldMap);
|
||||
}
|
||||
if (map) {
|
||||
this.initial_ = true;
|
||||
this.updateState_();
|
||||
this.registerListeners_(map);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @private
|
||||
*/
|
||||
Link.prototype.registerListeners_ = function (map) {
|
||||
this.listenerKeys_.push(listen(map, MapEventType.MOVEEND, this.updateUrl_, this), listen(map.getLayerGroup(), EventType.CHANGE, this.updateUrl_, this), listen(map, 'change:layergroup', this.handleChangeLayerGroup_, this));
|
||||
if (!this.replace_) {
|
||||
addEventListener('popstate', this.updateState_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @private
|
||||
*/
|
||||
Link.prototype.unregisterListeners_ = function (map) {
|
||||
for (var i = 0, ii = this.listenerKeys_.length; i < ii; ++i) {
|
||||
unlistenByKey(this.listenerKeys_[i]);
|
||||
}
|
||||
this.listenerKeys_.length = 0;
|
||||
if (!this.replace_) {
|
||||
removeEventListener('popstate', this.updateState_);
|
||||
}
|
||||
var url = new URL(window.location.href);
|
||||
var params = url.searchParams;
|
||||
this.delete_(params, 'x');
|
||||
this.delete_(params, 'y');
|
||||
this.delete_(params, 'z');
|
||||
this.delete_(params, 'r');
|
||||
this.delete_(params, 'l');
|
||||
window.history.replaceState(null, '', url);
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Link.prototype.handleChangeLayerGroup_ = function () {
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
this.unregisterListeners_(map);
|
||||
this.registerListeners_(map);
|
||||
this.initial_ = true;
|
||||
this.updateUrl_();
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Link.prototype.updateState_ = function () {
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
var url = new URL(window.location.href);
|
||||
var params = url.searchParams;
|
||||
var updateView = false;
|
||||
/**
|
||||
* @type {import('../View.js').AnimationOptions}
|
||||
*/
|
||||
var viewProperties = {};
|
||||
var zoom = readNumber(this.get_(params, 'z'));
|
||||
if (differentNumber(zoom, view.getZoom())) {
|
||||
updateView = true;
|
||||
viewProperties.zoom = zoom;
|
||||
}
|
||||
var rotation = readNumber(this.get_(params, 'r'));
|
||||
if (differentNumber(rotation, view.getRotation())) {
|
||||
updateView = true;
|
||||
viewProperties.rotation = rotation;
|
||||
}
|
||||
var center = [
|
||||
readNumber(this.get_(params, 'x')),
|
||||
readNumber(this.get_(params, 'y')),
|
||||
];
|
||||
if (differentArray(center, view.getCenter())) {
|
||||
updateView = true;
|
||||
viewProperties.center = center;
|
||||
}
|
||||
if (updateView) {
|
||||
if (!this.initial_ && this.animationOptions_) {
|
||||
view.animate(assign(viewProperties, this.animationOptions_));
|
||||
}
|
||||
else {
|
||||
if (viewProperties.center) {
|
||||
view.setCenter(viewProperties.center);
|
||||
}
|
||||
if ('zoom' in viewProperties) {
|
||||
view.setZoom(viewProperties.zoom);
|
||||
}
|
||||
if ('rotation' in viewProperties) {
|
||||
view.setRotation(viewProperties.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
var layers = map.getAllLayers();
|
||||
var layersParam = this.get_(params, 'l');
|
||||
if (layersParam && layersParam.length === layers.length) {
|
||||
for (var i = 0, ii = layers.length; i < ii; ++i) {
|
||||
var value = parseInt(layersParam[i]);
|
||||
if (!isNaN(value)) {
|
||||
var visible = Boolean(value);
|
||||
var layer = layers[i];
|
||||
if (layer.getVisible() !== visible) {
|
||||
layer.setVisible(visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Link.prototype.updateUrl_ = function () {
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
var view = map.getView();
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
var initial = this.initial_;
|
||||
this.initial_ = false;
|
||||
var center = view.getCenter();
|
||||
var zoom = view.getZoom();
|
||||
var rotation = view.getRotation();
|
||||
var layers = map.getAllLayers();
|
||||
var visibilities = new Array(layers.length);
|
||||
for (var i = 0, ii = layers.length; i < ii; ++i) {
|
||||
visibilities[i] = layers[i].getVisible() ? '1' : '0';
|
||||
}
|
||||
var url = new URL(window.location.href);
|
||||
var params = url.searchParams;
|
||||
this.set_(params, 'x', writeNumber(center[0]));
|
||||
this.set_(params, 'y', writeNumber(center[1]));
|
||||
this.set_(params, 'z', writeNumber(zoom));
|
||||
this.set_(params, 'r', writeNumber(rotation));
|
||||
this.set_(params, 'l', visibilities.join(''));
|
||||
if (url.href !== window.location.href) {
|
||||
if (initial || this.replace_) {
|
||||
window.history.replaceState(null, '', url);
|
||||
}
|
||||
else {
|
||||
window.history.pushState(null, '', url);
|
||||
}
|
||||
}
|
||||
};
|
||||
return Link;
|
||||
}(Interaction));
|
||||
export default Link;
|
||||
//# sourceMappingURL=Link.js.map
|
||||
1
node_modules/ol/interaction/Link.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Link.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
523
node_modules/ol/interaction/Modify.d.ts
generated
vendored
Normal file
523
node_modules/ol/interaction/Modify.d.ts
generated
vendored
Normal file
@@ -0,0 +1,523 @@
|
||||
/**
|
||||
* @typedef {Object} SegmentData
|
||||
* @property {Array<number>} [depth] Depth.
|
||||
* @property {import("../Feature").FeatureLike} feature Feature.
|
||||
* @property {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||
* @property {number} [index] Index.
|
||||
* @property {Array<Array<number>>} segment Segment.
|
||||
* @property {Array<SegmentData>} [featureSegments] FeatureSegments.
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event will be considered to add or move a
|
||||
* vertex to the sketch. Default is
|
||||
* {@link module:ol/events/condition.primaryAction}.
|
||||
* @property {import("../events/condition.js").Condition} [deleteCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. By default,
|
||||
* {@link module:ol/events/condition.singleClick} with
|
||||
* {@link module:ol/events/condition.altKeyOnly} results in a vertex deletion.
|
||||
* @property {import("../events/condition.js").Condition} [insertVertexCondition] A
|
||||
* function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
|
||||
* returns a boolean to indicate whether a new vertex should be added to the sketch
|
||||
* features. Default is {@link module:ol/events/condition.always}.
|
||||
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
|
||||
* pointer close enough to a segment or vertex for editing.
|
||||
* @property {import("../style/Style.js").StyleLike} [style]
|
||||
* Style used for the modification point or vertex. For linestrings and polygons, this will
|
||||
* be the affected vertex, for circles a point along the circle, and for points the actual
|
||||
* point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).
|
||||
* When using a style function, the point feature passed to the function will have a `features`
|
||||
* property - an array whose entries are the features that are being modified, and a `geometries`
|
||||
* property - an array whose entries are the geometries that are being modified. Both arrays are
|
||||
* in the same order. The `geometries` are only useful when modifying geometry collections, where
|
||||
* the geometry will be the particular geometry from the collection that is being modified.
|
||||
* @property {VectorSource} [source] The vector source with
|
||||
* features to modify. If a vector source is not provided, a feature collection
|
||||
* must be provided with the `features` option.
|
||||
* @property {boolean|import("../layer/BaseVector").default} [hitDetection] When configured, point
|
||||
* features will be considered for modification based on their visual appearance, instead of being within
|
||||
* the `pixelTolerance` from the pointer location. When a {@link module:ol/layer/BaseVector~BaseVectorLayer} is
|
||||
* provided, only the rendered representation of the features on that layer will be considered.
|
||||
* @property {Collection<Feature>} [features]
|
||||
* The features the interaction works on. If a feature collection is not
|
||||
* provided, a vector source must be provided with the `source` option.
|
||||
* @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
|
||||
* overlay.
|
||||
* @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the
|
||||
* pointer coordinate when clicked within the `pixelTolerance`.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Modify~Modify} instances are
|
||||
* instances of this type.
|
||||
*/
|
||||
export class ModifyEvent extends Event {
|
||||
/**
|
||||
* @param {ModifyEventType} type Type.
|
||||
* @param {Collection<import("../Feature").FeatureLike>} features
|
||||
* The features modified.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
*/
|
||||
constructor(type: ModifyEventType, features: Collection<import("../Feature").FeatureLike>, mapBrowserEvent: import("../MapBrowserEvent.js").default<any>);
|
||||
/**
|
||||
* The features being modified.
|
||||
* @type {Collection<import("../Feature").FeatureLike>}
|
||||
* @api
|
||||
*/
|
||||
features: Collection<import("../Feature").FeatureLike>;
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
mapBrowserEvent: import("../MapBrowserEvent.js").default<any>;
|
||||
}
|
||||
export default Modify;
|
||||
export type SegmentData = {
|
||||
/**
|
||||
* Depth.
|
||||
*/
|
||||
depth?: number[] | undefined;
|
||||
/**
|
||||
* Feature.
|
||||
*/
|
||||
feature: import("../Feature").FeatureLike;
|
||||
/**
|
||||
* Geometry.
|
||||
*/
|
||||
geometry: import("../geom/SimpleGeometry.js").default;
|
||||
/**
|
||||
* Index.
|
||||
*/
|
||||
index?: number | undefined;
|
||||
/**
|
||||
* Segment.
|
||||
*/
|
||||
segment: Array<Array<number>>;
|
||||
/**
|
||||
* FeatureSegments.
|
||||
*/
|
||||
featureSegments?: SegmentData[] | undefined;
|
||||
};
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event will be considered to add or move a
|
||||
* vertex to the sketch. Default is
|
||||
* {@link module :ol/events/condition.primaryAction}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. By default,
|
||||
* {@link module :ol/events/condition.singleClick} with
|
||||
* {@link module :ol/events/condition.altKeyOnly} results in a vertex deletion.
|
||||
*/
|
||||
deleteCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A
|
||||
* function that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and
|
||||
* returns a boolean to indicate whether a new vertex should be added to the sketch
|
||||
* features. Default is {@link module :ol/events/condition.always}.
|
||||
*/
|
||||
insertVertexCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Pixel tolerance for considering the
|
||||
* pointer close enough to a segment or vertex for editing.
|
||||
*/
|
||||
pixelTolerance?: number | undefined;
|
||||
/**
|
||||
* Style used for the modification point or vertex. For linestrings and polygons, this will
|
||||
* be the affected vertex, for circles a point along the circle, and for points the actual
|
||||
* point. If not configured, the default edit style is used (see {@link module :ol/style/Style~Style}).
|
||||
* When using a style function, the point feature passed to the function will have a `features`
|
||||
* property - an array whose entries are the features that are being modified, and a `geometries`
|
||||
* property - an array whose entries are the geometries that are being modified. Both arrays are
|
||||
* in the same order. The `geometries` are only useful when modifying geometry collections, where
|
||||
* the geometry will be the particular geometry from the collection that is being modified.
|
||||
*/
|
||||
style?: import("../style/Style.js").StyleLike | undefined;
|
||||
/**
|
||||
* The vector source with
|
||||
* features to modify. If a vector source is not provided, a feature collection
|
||||
* must be provided with the `features` option.
|
||||
*/
|
||||
source?: VectorSource<import("../geom/Geometry.js").default> | undefined;
|
||||
/**
|
||||
* When configured, point
|
||||
* features will be considered for modification based on their visual appearance, instead of being within
|
||||
* the `pixelTolerance` from the pointer location. When a {@link module :ol/layer/BaseVector~BaseVectorLayer} is
|
||||
* provided, only the rendered representation of the features on that layer will be considered.
|
||||
*/
|
||||
hitDetection?: boolean | import("../layer/BaseVector").default<any, any> | undefined;
|
||||
/**
|
||||
* The features the interaction works on. If a feature collection is not
|
||||
* provided, a vector source must be provided with the `source` option.
|
||||
*/
|
||||
features?: Collection<Feature<import("../geom/Geometry.js").default>> | undefined;
|
||||
/**
|
||||
* Wrap the world horizontally on the sketch
|
||||
* overlay.
|
||||
*/
|
||||
wrapX?: boolean | undefined;
|
||||
/**
|
||||
* The vertex, point or segment being modified snaps to the
|
||||
* pointer coordinate when clicked within the `pixelTolerance`.
|
||||
*/
|
||||
snapToPointer?: boolean | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type ModifyOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'modifyend' | 'modifystart', ModifyEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'modifyend' | 'modifystart', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
import Collection from "../Collection.js";
|
||||
type ModifyEventType = string;
|
||||
declare namespace ModifyEventType {
|
||||
const MODIFYSTART: string;
|
||||
const MODIFYEND: string;
|
||||
}
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'modifyend'|'modifystart', Return>} ModifyOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for modifying feature geometries. To modify features that have
|
||||
* been added to an existing source, construct the modify interaction with the
|
||||
* `source` option. If you want to modify features in a collection (for example,
|
||||
* the collection used by a select interaction), construct the interaction with
|
||||
* the `features` option. The interaction must be constructed with either a
|
||||
* `source` or `features` option.
|
||||
*
|
||||
* Cartesian distance from the pointer is used to determine the features that
|
||||
* will be modified. This means that geometries will only be considered for
|
||||
* modification when they are within the configured `pixelTolerance`. For point
|
||||
* geometries, the `hitDetection` option can be used to match their visual
|
||||
* appearance.
|
||||
*
|
||||
* By default, the interaction will allow deletion of vertices when the `alt`
|
||||
* key is pressed. To configure the interaction with a different condition
|
||||
* for deletion, use the `deleteCondition` option.
|
||||
* @fires ModifyEvent
|
||||
* @api
|
||||
*/
|
||||
declare class Modify extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options: Options);
|
||||
/***
|
||||
* @type {ModifyOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: ModifyOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ModifyOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: ModifyOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {ModifyOnSignature<void>}
|
||||
*/
|
||||
un: ModifyOnSignature<void>;
|
||||
/** @private */
|
||||
private boundHandleFeatureChange_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
|
||||
* @return {boolean} Combined condition result.
|
||||
*/
|
||||
private defaultDeleteCondition_;
|
||||
/**
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
* @private
|
||||
*/
|
||||
private deleteCondition_;
|
||||
/**
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
* @private
|
||||
*/
|
||||
private insertVertexCondition_;
|
||||
/**
|
||||
* Editing vertex.
|
||||
* @type {Feature<Point>}
|
||||
* @private
|
||||
*/
|
||||
private vertexFeature_;
|
||||
/**
|
||||
* Segments intersecting {@link this.vertexFeature_} by segment uid.
|
||||
* @type {Object<string, boolean>}
|
||||
* @private
|
||||
*/
|
||||
private vertexSegments_;
|
||||
/**
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
* @private
|
||||
*/
|
||||
private lastPixel_;
|
||||
/**
|
||||
* Tracks if the next `singleclick` event should be ignored to prevent
|
||||
* accidental deletion right after vertex creation.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private ignoreNextSingleClick_;
|
||||
/**
|
||||
* @type {Collection<import("../Feature").FeatureLike>}
|
||||
* @private
|
||||
*/
|
||||
private featuresBeingModified_;
|
||||
/**
|
||||
* Segment RTree for each layer
|
||||
* @type {RBush<SegmentData>}
|
||||
* @private
|
||||
*/
|
||||
private rBush_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private pixelTolerance_;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private snappedToVertex_;
|
||||
/**
|
||||
* Indicate whether the interaction is currently changing a feature's
|
||||
* coordinates.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
private changingFeature_;
|
||||
/**
|
||||
* @type {Array}
|
||||
* @private
|
||||
*/
|
||||
private dragSegments_;
|
||||
/**
|
||||
* Draw overlay where sketch features are drawn.
|
||||
* @type {VectorLayer}
|
||||
* @private
|
||||
*/
|
||||
private overlay_;
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {!Object<string, function(Feature, import("../geom/Geometry.js").default): void>}
|
||||
*/
|
||||
private SEGMENT_WRITERS_;
|
||||
/**
|
||||
* @type {VectorSource}
|
||||
* @private
|
||||
*/
|
||||
private source_;
|
||||
/**
|
||||
* @type {boolean|import("../layer/BaseVector").default}
|
||||
*/
|
||||
hitDetection_: boolean | import("../layer/BaseVector").default<any, any>;
|
||||
/**
|
||||
* @type {Collection<import("../Feature.js").FeatureLike>}
|
||||
* @private
|
||||
*/
|
||||
private features_;
|
||||
/**
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @private
|
||||
*/
|
||||
private lastPointerEvent_;
|
||||
/**
|
||||
* Delta (x, y in map units) between matched rtree vertex and pointer vertex.
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
delta_: Array<number>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private snapToPointer_;
|
||||
/**
|
||||
* @param {Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private addFeature_;
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} evt Map browser event.
|
||||
* @param {Array<Array<SegmentData>>} segments The segments subject to modification.
|
||||
* @private
|
||||
*/
|
||||
private willModifyFeatures_;
|
||||
/**
|
||||
* @param {Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private removeFeature_;
|
||||
/**
|
||||
* @param {Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private removeFeatureSegmentData_;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* Get the overlay layer that this interaction renders the modification point or vertex to.
|
||||
* @return {VectorLayer} Overlay layer.
|
||||
* @api
|
||||
*/
|
||||
getOverlay(): VectorLayer<any>;
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent} event Event.
|
||||
* @private
|
||||
*/
|
||||
private handleSourceAdd_;
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent} event Event.
|
||||
* @private
|
||||
*/
|
||||
private handleSourceRemove_;
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureAdd_;
|
||||
/**
|
||||
* @param {import("../events/Event.js").default} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureChange_;
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureRemove_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {Point} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writePointGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/MultiPoint.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeMultiPointGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/LineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeLineStringGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/MultiLineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeMultiLineStringGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/Polygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writePolygonGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeMultiPolygonGeometry_;
|
||||
/**
|
||||
* We convert a circle into two segments. The segment at index
|
||||
* {@link CIRCLE_CENTER_INDEX} is the
|
||||
* circle's center (a point). The segment at index
|
||||
* {@link CIRCLE_CIRCUMFERENCE_INDEX} is
|
||||
* the circumference, and is not a line segment.
|
||||
*
|
||||
* @param {Feature} feature Feature.
|
||||
* @param {import("../geom/Circle.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeCircleGeometry_;
|
||||
/**
|
||||
* @param {Feature} feature Feature
|
||||
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private writeGeometryCollectionGeometry_;
|
||||
/**
|
||||
* @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
|
||||
* @param {Array<import("../Feature").FeatureLike>} features The features being modified.
|
||||
* @param {Array<import("../geom/SimpleGeometry.js").default>} geometries The geometries being modified.
|
||||
* @return {Feature} Vertex feature.
|
||||
* @private
|
||||
*/
|
||||
private createOrUpdateVertexFeature_;
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handlePointerMove_;
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @param {import("../coordinate.js").Coordinate} [opt_coordinate] The pixel Coordinate.
|
||||
* @private
|
||||
*/
|
||||
private handlePointerAtPixel_;
|
||||
/**
|
||||
* @param {SegmentData} segmentData Segment data.
|
||||
* @param {import("../coordinate.js").Coordinate} vertex Vertex.
|
||||
* @private
|
||||
*/
|
||||
private insertVertex_;
|
||||
/**
|
||||
* Removes the vertex currently being pointed.
|
||||
* @return {boolean} True when a vertex was removed.
|
||||
* @api
|
||||
*/
|
||||
removePoint(): boolean;
|
||||
/**
|
||||
* Removes a vertex from all matching features.
|
||||
* @return {boolean} True when a vertex was removed.
|
||||
* @private
|
||||
*/
|
||||
private removeVertex_;
|
||||
/**
|
||||
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||
* @param {Array} coordinates Coordinates.
|
||||
* @private
|
||||
*/
|
||||
private setGeometryCoordinates_;
|
||||
/**
|
||||
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||
* @param {number} index Index.
|
||||
* @param {Array<number>|undefined} depth Depth.
|
||||
* @param {number} delta Delta (1 or -1).
|
||||
* @private
|
||||
*/
|
||||
private updateSegmentIndices_;
|
||||
}
|
||||
import VectorSource from "../source/Vector.js";
|
||||
import Feature from "../Feature.js";
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
import VectorLayer from "../layer/Vector.js";
|
||||
//# sourceMappingURL=Modify.d.ts.map
|
||||
1
node_modules/ol/interaction/Modify.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Modify.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Modify.d.ts","sourceRoot":"","sources":["../src/interaction/Modify.js"],"names":[],"mappings":"AAgFA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,kBANW,eAAe,YACf,WAAW,OAAO,YAAY,EAAE,WAAW,CAAC,iEAqBtD;IAbC;;;;OAIG;IACH,UAHU,WAAW,OAAO,YAAY,EAAE,WAAW,CAAC,CAG9B;IAExB;;;;OAIG;IACH,8DAAsC;CAEzC;;;;;;;;;;aAhFa,OAAO,YAAY,EAAE,WAAW;;;;cAChC,OAAO,2BAA2B,EAAE,OAAO;;;;;;;;aAE3C,MAAM,MAAM,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAiFrB,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,eAAqB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC/D,OAAW,eAAe,EAAE,WAAW,C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H,oBAaC;IAED;;;;OAIG;IACH,4BAyBC;IAED;;;OAGG;IACH,uBAWC;IAED;;;OAGG;IACH,kCAuBC;IAgBD;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAK9C;IAED;;;;OAIG;IACH,+BAEC;IAED;;;OAGG;IACH,yBAIC;IAED;;;OAGG;IACH,4BAIC;IAED;;;OAGG;IACH,0BAEC;IAED;;;OAGG;IACH,6BAMC;IAED;;;OAGG;IACH,6BAGC;IAED;;;;OAIG;IACH,4BAWC;IAED;;;;OAIG;IACH,iCAgBC;IAED;;;;OAIG;IACH,iCAeC;IAED;;;;OAIG;IACH,sCAmBC;IAED;;;;OAIG;IACH,8BAmBC;IAED;;;;OAIG;IACH,mCAsBC;IAED;;;;;;;;;;OAUG;IACH,6BAqCC;IAED;;;;OAIG;IACH,yCAOC;IAED;;;;;;OAMG;IACH,qCAaC;IA6TD;;;OAGG;IACH,2BAGC;IAED;;;;;OAKG;IACH,8BAkIC;IAED;;;;OAIG;IACH,sBA8DC;IAED;;;;OAIG;IACH,eAHY,OAAO,CAyBlB;IAED;;;;OAIG;IACH,sBAiHC;IAED;;;;OAIG;IACH,gCAIC;IAED;;;;;;OAMG;IACH,8BAeC;CACF"}
|
||||
1412
node_modules/ol/interaction/Modify.js
generated
vendored
Normal file
1412
node_modules/ol/interaction/Modify.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/ol/interaction/Modify.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Modify.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
167
node_modules/ol/interaction/MouseWheelZoom.d.ts
generated
vendored
Normal file
167
node_modules/ol/interaction/MouseWheelZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
export type Mode = string;
|
||||
export namespace Mode {
|
||||
const TRACKPAD: string;
|
||||
const WHEEL: string;
|
||||
}
|
||||
export default MouseWheelZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module :ol/events/condition.always}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
*/
|
||||
onFocusOnly?: boolean | undefined;
|
||||
/**
|
||||
* Maximum mouse wheel delta.
|
||||
*/
|
||||
maxDelta?: number | undefined;
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* Mouse wheel timeout duration in milliseconds.
|
||||
*/
|
||||
timeout?: number | undefined;
|
||||
/**
|
||||
* Enable zooming using the mouse's
|
||||
* location as the anchor. When set to `false`, zooming in and out will zoom to
|
||||
* the center of the screen instead of zooming on the mouse's location.
|
||||
*/
|
||||
useAnchor?: boolean | undefined;
|
||||
/**
|
||||
* If true, the mouse wheel zoom
|
||||
* event will always animate to the closest zoom level after an interaction;
|
||||
* false means intermediary zoom levels are allowed.
|
||||
*/
|
||||
constrainResolution?: boolean | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.always}.
|
||||
* @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
* @property {number} [maxDelta=1] Maximum mouse wheel delta.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.
|
||||
* @property {boolean} [useAnchor=true] Enable zooming using the mouse's
|
||||
* location as the anchor. When set to `false`, zooming in and out will zoom to
|
||||
* the center of the screen instead of zooming on the mouse's location.
|
||||
* @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom
|
||||
* event will always animate to the closest zoom level after an interaction;
|
||||
* false means intermediary zoom levels are allowed.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
* @api
|
||||
*/
|
||||
declare class MouseWheelZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private totalDelta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private lastDelta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private maxDelta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private timeout_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private useAnchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private constrainResolution_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
private lastAnchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private startTime_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?}
|
||||
*/
|
||||
private timeoutId_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Mode|undefined}
|
||||
*/
|
||||
private mode_;
|
||||
/**
|
||||
* Trackpad events separated by this delay will be considered separate
|
||||
* interactions.
|
||||
* @type {number}
|
||||
*/
|
||||
trackpadEventGap_: number;
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
trackpadTimeoutId_: unknown;
|
||||
/**
|
||||
* The number of delta values per zoom level
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private deltaPerZoom_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private endInteraction_;
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
private handleWheelZoom_;
|
||||
/**
|
||||
* Enable or disable using the mouse's location as an anchor when zooming
|
||||
* @param {boolean} useAnchor true to zoom to the mouse's location, false
|
||||
* to zoom to the center of the map
|
||||
* @api
|
||||
*/
|
||||
setMouseAnchor(useAnchor: boolean): void;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=MouseWheelZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/MouseWheelZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/MouseWheelZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MouseWheelZoom.d.ts","sourceRoot":"","sources":["../src/interaction/MouseWheelZoom.js"],"names":[],"mappings":"mBAUU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOhB;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CAyGC;IAlGC;;;OAGG;IACH,oBAAoB;IAEpB;;;OAGG;IACH,mBAAmB;IAEnB;;;OAGG;IACH,kBAAsE;IAEtE;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,iBAAoE;IAEpE;;;OAGG;IACH,mBAC4D;IAE5D;;;OAGG;IACH,6BAGW;IAIX;;;OAGG;IACH,mBAEa;IAEb;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,mBAAe;IAEf;;;OAGG;IACH,cAAsB;IAEtB;;;;OAIG;IACH,mBAFU,MAAM,CAEY;IAE5B;;OAEG;IACH,4BAAuB;IAEvB;;;;OAIG;IACH,sBAAwB;IAG1B;;OAEG;IACH,wBAYC;IA2FD;;;OAGG;IACH,yBAsBC;IAED;;;;;OAKG;IACH,0BAJW,OAAO,QASjB;CACF"}
|
||||
265
node_modules/ol/interaction/MouseWheelZoom.js
generated
vendored
Normal file
265
node_modules/ol/interaction/MouseWheelZoom.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
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/interaction/MouseWheelZoom
|
||||
*/
|
||||
import EventType from '../events/EventType.js';
|
||||
import Interaction, { zoomByDelta } from './Interaction.js';
|
||||
import { DEVICE_PIXEL_RATIO, FIREFOX } from '../has.js';
|
||||
import { all, always, focusWithTabindex } from '../events/condition.js';
|
||||
import { clamp } from '../math.js';
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export var Mode = {
|
||||
TRACKPAD: 'trackpad',
|
||||
WHEEL: 'wheel',
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. Default is
|
||||
* {@link module:ol/events/condition.always}.
|
||||
* @property {boolean} [onFocusOnly=false] When the map's target has a `tabindex` attribute set,
|
||||
* the interaction will only handle events when the map has the focus.
|
||||
* @property {number} [maxDelta=1] Maximum mouse wheel delta.
|
||||
* @property {number} [duration=250] Animation duration in milliseconds.
|
||||
* @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.
|
||||
* @property {boolean} [useAnchor=true] Enable zooming using the mouse's
|
||||
* location as the anchor. When set to `false`, zooming in and out will zoom to
|
||||
* the center of the screen instead of zooming on the mouse's location.
|
||||
* @property {boolean} [constrainResolution=false] If true, the mouse wheel zoom
|
||||
* event will always animate to the closest zoom level after an interaction;
|
||||
* false means intermediary zoom levels are allowed.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
* @api
|
||||
*/
|
||||
var MouseWheelZoom = /** @class */ (function (_super) {
|
||||
__extends(MouseWheelZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function MouseWheelZoom(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this,
|
||||
/** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.totalDelta_ = 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.lastDelta_ = 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.timeout_ = options.timeout !== undefined ? options.timeout : 80;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.useAnchor_ =
|
||||
options.useAnchor !== undefined ? options.useAnchor : true;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.constrainResolution_ =
|
||||
options.constrainResolution !== undefined
|
||||
? options.constrainResolution
|
||||
: false;
|
||||
var condition = options.condition ? options.condition : always;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.onFocusOnly
|
||||
? all(focusWithTabindex, condition)
|
||||
: condition;
|
||||
/**
|
||||
* @private
|
||||
* @type {?import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
_this.lastAnchor_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.startTime_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {?}
|
||||
*/
|
||||
_this.timeoutId_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Mode|undefined}
|
||||
*/
|
||||
_this.mode_ = undefined;
|
||||
/**
|
||||
* Trackpad events separated by this delay will be considered separate
|
||||
* interactions.
|
||||
* @type {number}
|
||||
*/
|
||||
_this.trackpadEventGap_ = 400;
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
_this.trackpadTimeoutId_;
|
||||
/**
|
||||
* The number of delta values per zoom level
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.deltaPerZoom_ = 300;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
MouseWheelZoom.prototype.endInteraction_ = function () {
|
||||
this.trackpadTimeoutId_ = undefined;
|
||||
var map = this.getMap();
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
var view = map.getView();
|
||||
view.endInteraction(undefined, this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0, this.lastAnchor_);
|
||||
};
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
|
||||
* zooms the map.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
MouseWheelZoom.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
if (!this.condition_(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
var type = mapBrowserEvent.type;
|
||||
if (type !== EventType.WHEEL) {
|
||||
return true;
|
||||
}
|
||||
var map = mapBrowserEvent.map;
|
||||
var wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);
|
||||
wheelEvent.preventDefault();
|
||||
if (this.useAnchor_) {
|
||||
this.lastAnchor_ = mapBrowserEvent.coordinate;
|
||||
}
|
||||
// Delta normalisation inspired by
|
||||
// https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js
|
||||
var delta;
|
||||
if (mapBrowserEvent.type == EventType.WHEEL) {
|
||||
delta = wheelEvent.deltaY;
|
||||
if (FIREFOX && wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
|
||||
delta /= DEVICE_PIXEL_RATIO;
|
||||
}
|
||||
if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) {
|
||||
delta *= 40;
|
||||
}
|
||||
}
|
||||
if (delta === 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
this.lastDelta_ = delta;
|
||||
}
|
||||
var now = Date.now();
|
||||
if (this.startTime_ === undefined) {
|
||||
this.startTime_ = now;
|
||||
}
|
||||
if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
|
||||
this.mode_ = Math.abs(delta) < 4 ? Mode.TRACKPAD : Mode.WHEEL;
|
||||
}
|
||||
var view = map.getView();
|
||||
if (this.mode_ === Mode.TRACKPAD &&
|
||||
!(view.getConstrainResolution() || this.constrainResolution_)) {
|
||||
if (this.trackpadTimeoutId_) {
|
||||
clearTimeout(this.trackpadTimeoutId_);
|
||||
}
|
||||
else {
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
view.beginInteraction();
|
||||
}
|
||||
this.trackpadTimeoutId_ = setTimeout(this.endInteraction_.bind(this), this.timeout_);
|
||||
view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_);
|
||||
this.startTime_ = now;
|
||||
return false;
|
||||
}
|
||||
this.totalDelta_ += delta;
|
||||
var timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);
|
||||
clearTimeout(this.timeoutId_);
|
||||
this.timeoutId_ = setTimeout(this.handleWheelZoom_.bind(this, map), timeLeft);
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
MouseWheelZoom.prototype.handleWheelZoom_ = function (map) {
|
||||
var view = map.getView();
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
var delta = -clamp(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_;
|
||||
if (view.getConstrainResolution() || this.constrainResolution_) {
|
||||
// view has a zoom constraint, zoom by 1
|
||||
delta = delta ? (delta > 0 ? 1 : -1) : 0;
|
||||
}
|
||||
zoomByDelta(view, delta, this.lastAnchor_, this.duration_);
|
||||
this.mode_ = undefined;
|
||||
this.totalDelta_ = 0;
|
||||
this.lastAnchor_ = null;
|
||||
this.startTime_ = undefined;
|
||||
this.timeoutId_ = undefined;
|
||||
};
|
||||
/**
|
||||
* Enable or disable using the mouse's location as an anchor when zooming
|
||||
* @param {boolean} useAnchor true to zoom to the mouse's location, false
|
||||
* to zoom to the center of the map
|
||||
* @api
|
||||
*/
|
||||
MouseWheelZoom.prototype.setMouseAnchor = function (useAnchor) {
|
||||
this.useAnchor_ = useAnchor;
|
||||
if (!useAnchor) {
|
||||
this.lastAnchor_ = null;
|
||||
}
|
||||
};
|
||||
return MouseWheelZoom;
|
||||
}(Interaction));
|
||||
export default MouseWheelZoom;
|
||||
//# sourceMappingURL=MouseWheelZoom.js.map
|
||||
1
node_modules/ol/interaction/MouseWheelZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/MouseWheelZoom.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
62
node_modules/ol/interaction/PinchRotate.d.ts
generated
vendored
Normal file
62
node_modules/ol/interaction/PinchRotate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
export default PinchRotate;
|
||||
export type Options = {
|
||||
/**
|
||||
* The duration of the animation in
|
||||
* milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
/**
|
||||
* Minimal angle in radians to start a rotation.
|
||||
*/
|
||||
threshold?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=250] The duration of the animation in
|
||||
* milliseconds.
|
||||
* @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to rotate the map by twisting with two fingers
|
||||
* on a touch screen.
|
||||
* @api
|
||||
*/
|
||||
declare class PinchRotate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
private anchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lastAngle_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private rotating_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private rotationDelta_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private threshold_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=PinchRotate.d.ts.map
|
||||
1
node_modules/ol/interaction/PinchRotate.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/PinchRotate.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PinchRotate.d.ts","sourceRoot":"","sources":["../src/interaction/PinchRotate.js"],"names":[],"mappings":";;;;;;;;;;;;AASA;;;;;GAKG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,+CAgDC;IAnCC;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,kBAAsB;IAEtB;;;OAGG;IACH,uBAAyB;IAEzB;;;OAGG;IACH,mBAA2E;IAE3E;;;OAGG;IACH,kBAAwE;CAuF3E"}
|
||||
157
node_modules/ol/interaction/PinchRotate.js
generated
vendored
Normal file
157
node_modules/ol/interaction/PinchRotate.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
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/interaction/PinchRotate
|
||||
*/
|
||||
import PointerInteraction, { centroid as centroidFromPointers, } from './Pointer.js';
|
||||
import { FALSE } from '../functions.js';
|
||||
import { disable } from '../rotationconstraint.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=250] The duration of the animation in
|
||||
* milliseconds.
|
||||
* @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to rotate the map by twisting with two fingers
|
||||
* on a touch screen.
|
||||
* @api
|
||||
*/
|
||||
var PinchRotate = /** @class */ (function (_super) {
|
||||
__extends(PinchRotate, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function PinchRotate(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
|
||||
if (!pointerOptions.stopDown) {
|
||||
pointerOptions.stopDown = FALSE;
|
||||
}
|
||||
_this = _super.call(this, pointerOptions) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
_this.anchor_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.lastAngle_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.rotating_ = false;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.rotationDelta_ = 0.0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
PinchRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
var rotationDelta = 0.0;
|
||||
var touch0 = this.targetPointers[0];
|
||||
var touch1 = this.targetPointers[1];
|
||||
// angle between touches
|
||||
var angle = Math.atan2(touch1.clientY - touch0.clientY, touch1.clientX - touch0.clientX);
|
||||
if (this.lastAngle_ !== undefined) {
|
||||
var delta = angle - this.lastAngle_;
|
||||
this.rotationDelta_ += delta;
|
||||
if (!this.rotating_ && Math.abs(this.rotationDelta_) > this.threshold_) {
|
||||
this.rotating_ = true;
|
||||
}
|
||||
rotationDelta = delta;
|
||||
}
|
||||
this.lastAngle_ = angle;
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
if (view.getConstraints().rotation === disable) {
|
||||
return;
|
||||
}
|
||||
// rotate anchor point.
|
||||
// FIXME: should be the intersection point between the lines:
|
||||
// touch0,touch1 and previousTouch0,previousTouch1
|
||||
var viewportPosition = map.getViewport().getBoundingClientRect();
|
||||
var centroid = centroidFromPointers(this.targetPointers);
|
||||
centroid[0] -= viewportPosition.left;
|
||||
centroid[1] -= viewportPosition.top;
|
||||
this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
|
||||
// rotate
|
||||
if (this.rotating_) {
|
||||
map.render();
|
||||
view.adjustRotationInternal(rotationDelta, this.anchor_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
PinchRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
if (this.targetPointers.length < 2) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
view.endInteraction(this.duration_);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
PinchRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (this.targetPointers.length >= 2) {
|
||||
var map = mapBrowserEvent.map;
|
||||
this.anchor_ = null;
|
||||
this.lastAngle_ = undefined;
|
||||
this.rotating_ = false;
|
||||
this.rotationDelta_ = 0.0;
|
||||
if (!this.handlingDownUpSequence) {
|
||||
map.getView().beginInteraction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return PinchRotate;
|
||||
}(PointerInteraction));
|
||||
export default PinchRotate;
|
||||
//# sourceMappingURL=PinchRotate.js.map
|
||||
1
node_modules/ol/interaction/PinchRotate.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/PinchRotate.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PinchRotate.js","sourceRoot":"","sources":["../src/interaction/PinchRotate.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,kBAAkB,EAAE,EACzB,QAAQ,IAAI,oBAAoB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAC;AAEjD;;;;;GAKG;AAEH;;;;;GAKG;AACH;IAA0B,+BAAkB;IAC1C;;OAEG;IACH,qBAAY,WAAW;QAAvB,iBAgDC;QA/CC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/C,IAAM,cAAc,GAAG,6CAA6C,CAAC,CACnE,OAAO,CACR,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;YAC5B,cAAc,CAAC,QAAQ,GAAG,KAAK,CAAC;SACjC;gBAED,kBAAM,cAAc,CAAC;QAErB;;;WAGG;QACH,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAEpB;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QAEvB;;;WAGG;QACH,KAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAE1B;;;WAGG;QACH,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,S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AAO,EAAE,CAAC,gBAAgB,EAAE,CAAC;aAClC;YACD,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA1ID,CAA0B,kBAAkB,GA0I3C;AAED,eAAe,WAAW,CAAC"}
|
||||
45
node_modules/ol/interaction/PinchZoom.d.ts
generated
vendored
Normal file
45
node_modules/ol/interaction/PinchZoom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
export default PinchZoom;
|
||||
export type Options = {
|
||||
/**
|
||||
* Animation duration in milliseconds.
|
||||
*/
|
||||
duration?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=400] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by pinching with two fingers
|
||||
* on a touch screen.
|
||||
* @api
|
||||
*/
|
||||
declare class PinchZoom extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
private anchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private duration_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lastDistance_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private lastScaleDelta_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=PinchZoom.d.ts.map
|
||||
1
node_modules/ol/interaction/PinchZoom.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/PinchZoom.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PinchZoom.d.ts","sourceRoot":"","sources":["../src/interaction/PinchZoom.js"],"names":[],"mappings":";;;;;;;AAQA;;;GAGG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,+CAoCC;IAvBC;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,sBAA8B;IAE9B;;;OAGG;IACH,wBAAwB;CA8E3B"}
|
||||
137
node_modules/ol/interaction/PinchZoom.js
generated
vendored
Normal file
137
node_modules/ol/interaction/PinchZoom.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
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/interaction/PinchZoom
|
||||
*/
|
||||
import PointerInteraction, { centroid as centroidFromPointers, } from './Pointer.js';
|
||||
import { FALSE } from '../functions.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} [duration=400] Animation duration in milliseconds.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by pinching with two fingers
|
||||
* on a touch screen.
|
||||
* @api
|
||||
*/
|
||||
var PinchZoom = /** @class */ (function (_super) {
|
||||
__extends(PinchZoom, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function PinchZoom(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
|
||||
if (!pointerOptions.stopDown) {
|
||||
pointerOptions.stopDown = FALSE;
|
||||
}
|
||||
_this = _super.call(this, pointerOptions) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
*/
|
||||
_this.anchor_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.duration_ = options.duration !== undefined ? options.duration : 400;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.lastDistance_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.lastScaleDelta_ = 1;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
*/
|
||||
PinchZoom.prototype.handleDragEvent = function (mapBrowserEvent) {
|
||||
var scaleDelta = 1.0;
|
||||
var touch0 = this.targetPointers[0];
|
||||
var touch1 = this.targetPointers[1];
|
||||
var dx = touch0.clientX - touch1.clientX;
|
||||
var dy = touch0.clientY - touch1.clientY;
|
||||
// distance between touches
|
||||
var distance = Math.sqrt(dx * dx + dy * dy);
|
||||
if (this.lastDistance_ !== undefined) {
|
||||
scaleDelta = this.lastDistance_ / distance;
|
||||
}
|
||||
this.lastDistance_ = distance;
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
if (scaleDelta != 1.0) {
|
||||
this.lastScaleDelta_ = scaleDelta;
|
||||
}
|
||||
// scale anchor point.
|
||||
var viewportPosition = map.getViewport().getBoundingClientRect();
|
||||
var centroid = centroidFromPointers(this.targetPointers);
|
||||
centroid[0] -= viewportPosition.left;
|
||||
centroid[1] -= viewportPosition.top;
|
||||
this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
|
||||
// scale, bypass the resolution constraint
|
||||
map.render();
|
||||
view.adjustResolutionInternal(scaleDelta, this.anchor_);
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
PinchZoom.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
if (this.targetPointers.length < 2) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
var direction = this.lastScaleDelta_ > 1 ? 1 : -1;
|
||||
view.endInteraction(this.duration_, direction);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
PinchZoom.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
if (this.targetPointers.length >= 2) {
|
||||
var map = mapBrowserEvent.map;
|
||||
this.anchor_ = null;
|
||||
this.lastDistance_ = undefined;
|
||||
this.lastScaleDelta_ = 1;
|
||||
if (!this.handlingDownUpSequence) {
|
||||
map.getView().beginInteraction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return PinchZoom;
|
||||
}(PointerInteraction));
|
||||
export default PinchZoom;
|
||||
//# sourceMappingURL=PinchZoom.js.map
|
||||
1
node_modules/ol/interaction/PinchZoom.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/PinchZoom.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PinchZoom.js","sourceRoot":"","sources":["../src/interaction/PinchZoom.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,kBAAkB,EAAE,EACzB,QAAQ,IAAI,oBAAoB,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC;;;GAGG;AAEH;;;;;GAKG;AACH;IAAwB,6BAAkB;IACxC;;OAEG;IACH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e;QAC7B,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,CAAC,EAAE;YACnC,IAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;YAC/B,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;gBAChC,GAAG,CAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,CAAC;aAClC;YACD,OAAO,IAAI,CAAC;SACb;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AArHD,CAAwB,kBAAkB,GAqHzC;AAED,eAAe,SAAS,CAAC"}
|
||||
143
node_modules/ol/interaction/Pointer.d.ts
generated
vendored
Normal file
143
node_modules/ol/interaction/Pointer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @param {Array<PointerEvent>} pointerEvents List of events.
|
||||
* @return {import("../pixel.js").Pixel} Centroid pixel.
|
||||
*/
|
||||
export function centroid(pointerEvents: Array<PointerEvent>): import("../pixel.js").Pixel;
|
||||
export default PointerInteraction;
|
||||
export type Options = {
|
||||
/**
|
||||
* Function handling "down" events. If the function returns `true` then a drag
|
||||
* sequence is started.
|
||||
*/
|
||||
handleDownEvent?: ((arg0: import("../MapBrowserEvent.js").default<any>) => boolean) | undefined;
|
||||
/**
|
||||
* Function handling "drag" events. This function is called on "move" events
|
||||
* during a drag sequence.
|
||||
*/
|
||||
handleDragEvent?: ((arg0: import("../MapBrowserEvent.js").default<any>) => void) | undefined;
|
||||
/**
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. The function may return `false` to prevent the
|
||||
* propagation of the event to other interactions in the map's interactions
|
||||
* chain.
|
||||
*/
|
||||
handleEvent?: ((arg0: import("../MapBrowserEvent.js").default<any>) => boolean) | undefined;
|
||||
/**
|
||||
* Function handling "move" events. This function is called on "move" events.
|
||||
* This functions is also called during a drag sequence, so during a drag
|
||||
* sequence both the `handleDragEvent` function and this function are called.
|
||||
* If `handleDownEvent` is defined and it returns true this function will not
|
||||
* be called during a drag sequence.
|
||||
*/
|
||||
handleMoveEvent?: ((arg0: import("../MapBrowserEvent.js").default<any>) => void) | undefined;
|
||||
/**
|
||||
* Function handling "up" events. If the function returns `false` then the
|
||||
* current drag sequence is stopped.
|
||||
*/
|
||||
handleUpEvent?: ((arg0: import("../MapBrowserEvent.js").default<any>) => boolean) | undefined;
|
||||
/**
|
||||
* Should the down event be propagated to other interactions, or should be
|
||||
* stopped?
|
||||
*/
|
||||
stopDown?: ((arg0: boolean) => boolean) | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleDownEvent]
|
||||
* Function handling "down" events. If the function returns `true` then a drag
|
||||
* sequence is started.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):void} [handleDragEvent]
|
||||
* Function handling "drag" events. This function is called on "move" events
|
||||
* during a drag sequence.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. The function may return `false` to prevent the
|
||||
* propagation of the event to other interactions in the map's interactions
|
||||
* chain.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):void} [handleMoveEvent]
|
||||
* Function handling "move" events. This function is called on "move" events.
|
||||
* This functions is also called during a drag sequence, so during a drag
|
||||
* sequence both the `handleDragEvent` function and this function are called.
|
||||
* If `handleDownEvent` is defined and it returns true this function will not
|
||||
* be called during a drag sequence.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleUpEvent]
|
||||
* Function handling "up" events. If the function returns `false` then the
|
||||
* current drag sequence is stopped.
|
||||
* @property {function(boolean):boolean} [stopDown]
|
||||
* Should the down event be propagated to other interactions, or should be
|
||||
* stopped?
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Base class that calls user-defined functions on `down`, `move` and `up`
|
||||
* events. This class also manages "drag sequences".
|
||||
*
|
||||
* When the `handleDownEvent` user function returns `true` a drag sequence is
|
||||
* started. During a drag sequence the `handleDragEvent` user function is
|
||||
* called on `move` events. The drag sequence ends when the `handleUpEvent`
|
||||
* user function is called and returns `false`.
|
||||
* @api
|
||||
*/
|
||||
declare class PointerInteraction extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
* @protected
|
||||
*/
|
||||
protected handleDownEvent(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>): boolean;
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
protected handleDragEvent(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>): void;
|
||||
/**
|
||||
* Handle pointer move events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
protected handleMoveEvent(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>): void;
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
* @protected
|
||||
*/
|
||||
protected handleUpEvent(mapBrowserEvent: import("../MapBrowserEvent.js").default<any>): boolean;
|
||||
/**
|
||||
* This function is used to determine if "down" events should be propagated
|
||||
* to other interactions or should be stopped.
|
||||
* @param {boolean} handled Was the event handled by the interaction?
|
||||
* @return {boolean} Should the `down` event be stopped?
|
||||
*/
|
||||
stopDown(handled: boolean): boolean;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @protected
|
||||
*/
|
||||
protected handlingDownUpSequence: boolean;
|
||||
/**
|
||||
* @type {Array<PointerEvent>}
|
||||
* @protected
|
||||
*/
|
||||
protected targetPointers: Array<PointerEvent>;
|
||||
/**
|
||||
* Returns the current number of pointers involved in the interaction,
|
||||
* e.g. `2` when two fingers are used.
|
||||
* @return {number} The number of pointers.
|
||||
* @api
|
||||
*/
|
||||
getPointerCount(): number;
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @private
|
||||
*/
|
||||
private updateTrackedPointers_;
|
||||
}
|
||||
import Interaction from "./Interaction.js";
|
||||
//# sourceMappingURL=Pointer.d.ts.map
|
||||
1
node_modules/ol/interaction/Pointer.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Pointer.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Pointer.d.ts","sourceRoot":"","sources":["../src/interaction/Pointer.js"],"names":[],"mappings":"AA8LA;;;GAGG;AACH,wCAHW,MAAM,YAAY,CAAC,GAClB,OAAO,aAAa,EAAE,KAAK,CAWtC;;;;;;;+EAnM+D,OAAO;;;;;+EAGP,IAAI;;;;;;;2EAGJ,OAAO;;;;;;;;+EAKP,IAAI;;;;;6EAMJ,OAAO;;;;;uBAGhD,OAAO,KAAE,OAAO;;AAtBvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;GAUG;AACH;IACE;;OAEG;IACH,+CAsCC;IAYD;;;;;OAKG;IACH,0FAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,+FAAmC;IAuCnC;;;;OAIG;IACH,+FAAmC;IAEnC;;;;;OAKG;IACH,wFAHY,OAAO,CAKlB;IAED;;;;;OAKG;IACH,kBAHW,OAAO,GACN,OAAO,CAIlB;IAtGC;;;OAGG;IACH,kCAHU,OAAO,CAGkB;IAEnC;;;OAGG;IACH,0BAHU,MAAM,YAAY,CAAC,CAGL;IAG1B;;;;;OAKG;IACH,mBAHY,MAAM,CAKjB;IAmFD;;;OAGG;IACH,+BAIC;CACF"}
|
||||
207
node_modules/ol/interaction/Pointer.js
generated
vendored
Normal file
207
node_modules/ol/interaction/Pointer.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
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/interaction/Pointer
|
||||
*/
|
||||
import Interaction from './Interaction.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleDownEvent]
|
||||
* Function handling "down" events. If the function returns `true` then a drag
|
||||
* sequence is started.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):void} [handleDragEvent]
|
||||
* Function handling "drag" events. This function is called on "move" events
|
||||
* during a drag sequence.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
|
||||
* Method called by the map to notify the interaction that a browser event was
|
||||
* dispatched to the map. The function may return `false` to prevent the
|
||||
* propagation of the event to other interactions in the map's interactions
|
||||
* chain.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):void} [handleMoveEvent]
|
||||
* Function handling "move" events. This function is called on "move" events.
|
||||
* This functions is also called during a drag sequence, so during a drag
|
||||
* sequence both the `handleDragEvent` function and this function are called.
|
||||
* If `handleDownEvent` is defined and it returns true this function will not
|
||||
* be called during a drag sequence.
|
||||
* @property {function(import("../MapBrowserEvent.js").default):boolean} [handleUpEvent]
|
||||
* Function handling "up" events. If the function returns `false` then the
|
||||
* current drag sequence is stopped.
|
||||
* @property {function(boolean):boolean} [stopDown]
|
||||
* Should the down event be propagated to other interactions, or should be
|
||||
* stopped?
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Base class that calls user-defined functions on `down`, `move` and `up`
|
||||
* events. This class also manages "drag sequences".
|
||||
*
|
||||
* When the `handleDownEvent` user function returns `true` a drag sequence is
|
||||
* started. During a drag sequence the `handleDragEvent` user function is
|
||||
* called on `move` events. The drag sequence ends when the `handleUpEvent`
|
||||
* user function is called and returns `false`.
|
||||
* @api
|
||||
*/
|
||||
var PointerInteraction = /** @class */ (function (_super) {
|
||||
__extends(PointerInteraction, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function PointerInteraction(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this,
|
||||
/** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
|
||||
if (options.handleDownEvent) {
|
||||
_this.handleDownEvent = options.handleDownEvent;
|
||||
}
|
||||
if (options.handleDragEvent) {
|
||||
_this.handleDragEvent = options.handleDragEvent;
|
||||
}
|
||||
if (options.handleMoveEvent) {
|
||||
_this.handleMoveEvent = options.handleMoveEvent;
|
||||
}
|
||||
if (options.handleUpEvent) {
|
||||
_this.handleUpEvent = options.handleUpEvent;
|
||||
}
|
||||
if (options.stopDown) {
|
||||
_this.stopDown = options.stopDown;
|
||||
}
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @protected
|
||||
*/
|
||||
_this.handlingDownUpSequence = false;
|
||||
/**
|
||||
* @type {Array<PointerEvent>}
|
||||
* @protected
|
||||
*/
|
||||
_this.targetPointers = [];
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Returns the current number of pointers involved in the interaction,
|
||||
* e.g. `2` when two fingers are used.
|
||||
* @return {number} The number of pointers.
|
||||
* @api
|
||||
*/
|
||||
PointerInteraction.prototype.getPointerCount = function () {
|
||||
return this.targetPointers.length;
|
||||
};
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
* @protected
|
||||
*/
|
||||
PointerInteraction.prototype.handleDownEvent = function (mapBrowserEvent) {
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
PointerInteraction.prototype.handleDragEvent = function (mapBrowserEvent) { };
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into
|
||||
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
|
||||
* detected.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @api
|
||||
*/
|
||||
PointerInteraction.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
if (!mapBrowserEvent.originalEvent) {
|
||||
return true;
|
||||
}
|
||||
var stopEvent = false;
|
||||
this.updateTrackedPointers_(mapBrowserEvent);
|
||||
if (this.handlingDownUpSequence) {
|
||||
if (mapBrowserEvent.type == MapBrowserEventType.POINTERDRAG) {
|
||||
this.handleDragEvent(mapBrowserEvent);
|
||||
// prevent page scrolling during dragging
|
||||
mapBrowserEvent.originalEvent.preventDefault();
|
||||
}
|
||||
else if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
|
||||
var handledUp = this.handleUpEvent(mapBrowserEvent);
|
||||
this.handlingDownUpSequence =
|
||||
handledUp && this.targetPointers.length > 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {
|
||||
var handled = this.handleDownEvent(mapBrowserEvent);
|
||||
this.handlingDownUpSequence = handled;
|
||||
stopEvent = this.stopDown(handled);
|
||||
}
|
||||
else if (mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE) {
|
||||
this.handleMoveEvent(mapBrowserEvent);
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
/**
|
||||
* Handle pointer move events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
PointerInteraction.prototype.handleMoveEvent = function (mapBrowserEvent) { };
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
* @protected
|
||||
*/
|
||||
PointerInteraction.prototype.handleUpEvent = function (mapBrowserEvent) {
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* This function is used to determine if "down" events should be propagated
|
||||
* to other interactions or should be stopped.
|
||||
* @param {boolean} handled Was the event handled by the interaction?
|
||||
* @return {boolean} Should the `down` event be stopped?
|
||||
*/
|
||||
PointerInteraction.prototype.stopDown = function (handled) {
|
||||
return handled;
|
||||
};
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Event.
|
||||
* @private
|
||||
*/
|
||||
PointerInteraction.prototype.updateTrackedPointers_ = function (mapBrowserEvent) {
|
||||
if (mapBrowserEvent.activePointers) {
|
||||
this.targetPointers = mapBrowserEvent.activePointers;
|
||||
}
|
||||
};
|
||||
return PointerInteraction;
|
||||
}(Interaction));
|
||||
/**
|
||||
* @param {Array<PointerEvent>} pointerEvents List of events.
|
||||
* @return {import("../pixel.js").Pixel} Centroid pixel.
|
||||
*/
|
||||
export function centroid(pointerEvents) {
|
||||
var length = pointerEvents.length;
|
||||
var clientX = 0;
|
||||
var clientY = 0;
|
||||
for (var i = 0; i < length; i++) {
|
||||
clientX += pointerEvents[i].clientX;
|
||||
clientY += pointerEvents[i].clientY;
|
||||
}
|
||||
return [clientX / length, clientY / length];
|
||||
}
|
||||
export default PointerInteraction;
|
||||
//# sourceMappingURL=Pointer.js.map
|
||||
1
node_modules/ol/interaction/Pointer.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Pointer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Pointer.js","sourceRoot":"","sources":["../src/interaction/Pointer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;GAUG;AACH;IAAiC,sCAAW;IAC1C;;OAEG;IACH,4BAAY,WAAW;QAAvB,iBAsCC;QArCC,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBAE/C;QACE,4DAA4D,CAAC,CAAC,OAAO,CAAC,CACvE;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,KAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;SAChD;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,KAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;SAChD;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,KAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;SAChD;QAED,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,KAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;SAC5C;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;SAClC;QAED;;;WAGG;QACH,KAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;Q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AAI,eAAe,CAAC,IAAI,IAAI,mBAAmB,CAAC,WAAW,EAAE;gBAClE,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;aACvC;SACF;QACD,OAAO,CAAC,SAAS,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,4CAAe,GAAf,UAAgB,eAAe,IAAG,CAAC;IAEnC;;;;;OAKG;IACH,0CAAa,GAAb,UAAc,eAAe;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,qCAAQ,GAAR,UAAS,OAAO;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;OAGG;IACH,mDAAsB,GAAtB,UAAuB,eAAe;QACpC,IAAI,eAAe,CAAC,cAAc,EAAE;YAClC,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,cAAc,CAAC;SACtD;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AAhJD,CAAiC,WAAW,GAgJ3C;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,aAAa;IACpC,IAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;IACpC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACpC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;KACrC;IACD,OAAO,CAAC,OAAO,GAAG,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
||||
5
node_modules/ol/interaction/Property.d.ts
generated
vendored
Normal file
5
node_modules/ol/interaction/Property.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
declare namespace _default {
|
||||
const ACTIVE: string;
|
||||
}
|
||||
export default _default;
|
||||
//# sourceMappingURL=Property.d.ts.map
|
||||
1
node_modules/ol/interaction/Property.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Property.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../src/interaction/Property.js"],"names":[],"mappings":""}
|
||||
10
node_modules/ol/interaction/Property.js
generated
vendored
Normal file
10
node_modules/ol/interaction/Property.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @module ol/interaction/Property
|
||||
*/
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export default {
|
||||
ACTIVE: 'active',
|
||||
};
|
||||
//# sourceMappingURL=Property.js.map
|
||||
1
node_modules/ol/interaction/Property.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Property.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Property.js","sourceRoot":"","sources":["../src/interaction/Property.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAe;IACb,MAAM,EAAE,QAAQ;CACjB,CAAC"}
|
||||
364
node_modules/ol/interaction/Select.d.ts
generated
vendored
Normal file
364
node_modules/ol/interaction/Select.d.ts
generated
vendored
Normal file
@@ -0,0 +1,364 @@
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} or
|
||||
* {@link module:ol/render/Feature~RenderFeature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [addCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is the event
|
||||
* for the selected features as a whole. By default, this is
|
||||
* {@link module:ol/events/condition.singleClick}. Clicking on a feature selects that
|
||||
* feature and removes any that were in the selection. Clicking outside any
|
||||
* feature removes all from the selection.
|
||||
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
|
||||
* from the selection.
|
||||
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers]
|
||||
* A list of layers from which features should be selected. Alternatively, a
|
||||
* filter function can be provided. The function will be called for each layer
|
||||
* in the map and should return `true` for layers that you want to be
|
||||
* selectable. If the option is absent, all visible layers will be considered
|
||||
* selectable.
|
||||
* @property {import("../style/Style.js").StyleLike|null} [style]
|
||||
* Style for the selected features. By default the default edit style is used
|
||||
* (see {@link module:ol/style/Style~Style}). Set to `null` if this interaction should not apply
|
||||
* any style changes for selected features.
|
||||
* If set to a falsey value, the selected feature's style will not change.
|
||||
* @property {import("../events/condition.js").Condition} [removeCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
* @property {import("../events/condition.js").Condition} [toggleCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is in addition
|
||||
* to the `condition` event. By default,
|
||||
* {@link module:ol/events/condition.shiftKeyOnly}, i.e. pressing `shift` as
|
||||
* well as the `condition` event, adds that feature to the current selection if
|
||||
* it is not currently selected, and removes it if it is. See `add` and `remove`
|
||||
* if you want to use different events instead of a toggle.
|
||||
* @property {boolean} [multi=false] A boolean that determines if the default
|
||||
* behaviour should select only single features or all (overlapping) features at
|
||||
* the clicked map position. The default of `false` means single select.
|
||||
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
|
||||
* Collection where the interaction will place selected features. Optional. If
|
||||
* not set the interaction will create a collection. In any case the collection
|
||||
* used by the interaction is returned by
|
||||
* {@link module:ol/interaction/Select~Select#getFeatures}.
|
||||
* @property {FilterFunction} [filter] A function
|
||||
* that takes an {@link module:ol/Feature~Feature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside
|
||||
* the radius around the given position will be checked for features.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of
|
||||
* this type.
|
||||
*/
|
||||
export class SelectEvent extends Event {
|
||||
/**
|
||||
* @param {SelectEventType} type The event type.
|
||||
* @param {Array<import("../Feature.js").default>} selected Selected features.
|
||||
* @param {Array<import("../Feature.js").default>} deselected Deselected features.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated
|
||||
* {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
*/
|
||||
constructor(type: SelectEventType, selected: Array<import("../Feature.js").default>, deselected: Array<import("../Feature.js").default>, mapBrowserEvent: import("../MapBrowserEvent.js").default<any>);
|
||||
/**
|
||||
* Selected features array.
|
||||
* @type {Array<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
selected: Array<import("../Feature.js").default>;
|
||||
/**
|
||||
* Deselected features array.
|
||||
* @type {Array<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
deselected: Array<import("../Feature.js").default>;
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
mapBrowserEvent: import("../MapBrowserEvent.js").default<any>;
|
||||
}
|
||||
export default Select;
|
||||
/**
|
||||
* A function that takes an {@link module :ol/Feature~Feature} or
|
||||
* {@link module :ol/render/Feature~RenderFeature} and an
|
||||
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
*/
|
||||
export type FilterFunction = (arg0: import("../Feature.js").FeatureLike, arg1: import("../layer/Layer.js").default<import("../source/Source").default>) => boolean;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module :ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
*/
|
||||
addCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is the event
|
||||
* for the selected features as a whole. By default, this is
|
||||
* {@link module :ol/events/condition.singleClick}. Clicking on a feature selects that
|
||||
* feature and removes any that were in the selection. Clicking outside any
|
||||
* feature removes all from the selection.
|
||||
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
|
||||
* from the selection.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A list of layers from which features should be selected. Alternatively, a
|
||||
* filter function can be provided. The function will be called for each layer
|
||||
* in the map and should return `true` for layers that you want to be
|
||||
* selectable. If the option is absent, all visible layers will be considered
|
||||
* selectable.
|
||||
*/
|
||||
layers?: import("../layer/Layer.js").default<import("../source/Source").default, import("../renderer/Layer.js").default<any>>[] | ((arg0: import("../layer/Layer.js").default<import("../source/Source").default>) => boolean) | undefined;
|
||||
/**
|
||||
* Style for the selected features. By default the default edit style is used
|
||||
* (see {@link module :ol/style/Style~Style}). Set to `null` if this interaction should not apply
|
||||
* any style changes for selected features.
|
||||
* If set to a falsey value, the selected feature's style will not change.
|
||||
*/
|
||||
style?: import("../style/Style.js").StyleLike | null | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module :ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
*/
|
||||
removeCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is in addition
|
||||
* to the `condition` event. By default,
|
||||
* {@link module :ol/events/condition.shiftKeyOnly}, i.e. pressing `shift` as
|
||||
* well as the `condition` event, adds that feature to the current selection if
|
||||
* it is not currently selected, and removes it if it is. See `add` and `remove`
|
||||
* if you want to use different events instead of a toggle.
|
||||
*/
|
||||
toggleCondition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* A boolean that determines if the default
|
||||
* behaviour should select only single features or all (overlapping) features at
|
||||
* the clicked map position. The default of `false` means single select.
|
||||
*/
|
||||
multi?: boolean | undefined;
|
||||
/**
|
||||
* Collection where the interaction will place selected features. Optional. If
|
||||
* not set the interaction will create a collection. In any case the collection
|
||||
* used by the interaction is returned by
|
||||
* {@link module :ol/interaction/Select~Select#getFeatures}.
|
||||
*/
|
||||
features?: Collection<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/Feature~Feature} and an
|
||||
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
*/
|
||||
filter?: FilterFunction | undefined;
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside
|
||||
* the radius around the given position will be checked for features.
|
||||
*/
|
||||
hitTolerance?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type SelectOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'select', SelectEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'select', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
type SelectEventType = string;
|
||||
declare namespace SelectEventType {
|
||||
const SELECT: string;
|
||||
}
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'select', SelectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'select', Return>} SelectOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for selecting vector features. By default, selected features are
|
||||
* styled differently, so this interaction can be used for visual highlighting,
|
||||
* as well as selecting features for other actions, such as modification or
|
||||
* output. There are three ways of controlling which features are selected:
|
||||
* using the browser event as defined by the `condition` and optionally the
|
||||
* `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
|
||||
* further feature filter using the `filter` option.
|
||||
*
|
||||
* @fires SelectEvent
|
||||
* @api
|
||||
*/
|
||||
declare class Select extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {SelectOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: SelectOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {SelectOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: SelectOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {SelectOnSignature<void>}
|
||||
*/
|
||||
un: SelectOnSignature<void>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private boundAddFeature_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private boundRemoveFeature_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private addCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private removeCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private toggleCondition_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private multi_;
|
||||
/**
|
||||
* @private
|
||||
* @type {FilterFunction}
|
||||
*/
|
||||
private filter_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private hitTolerance_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null}
|
||||
*/
|
||||
private style_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../Collection.js").default}
|
||||
*/
|
||||
private features_;
|
||||
/**
|
||||
* @private
|
||||
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
|
||||
*/
|
||||
private layerFilter_;
|
||||
/**
|
||||
* An association between selected feature (key)
|
||||
* and layer (value)
|
||||
* @private
|
||||
* @type {Object<string, import("../layer/Layer.js").default>}
|
||||
*/
|
||||
private featureLayerAssociation_;
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @private
|
||||
*/
|
||||
private addFeatureLayerAssociation_;
|
||||
/**
|
||||
* Get the selected features.
|
||||
* @return {import("../Collection.js").default<import("../Feature.js").default>} Features collection.
|
||||
* @api
|
||||
*/
|
||||
getFeatures(): import("../Collection.js").default<import("../Feature.js").default>;
|
||||
/**
|
||||
* Returns the Hit-detection tolerance.
|
||||
* @return {number} Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
getHitTolerance(): number;
|
||||
/**
|
||||
* Returns the associated {@link module:ol/layer/Vector~VectorLayer vector layer} of
|
||||
* a selected feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature
|
||||
* @return {import('../layer/Vector.js').default} Layer.
|
||||
* @api
|
||||
*/
|
||||
getLayer(feature: import("../Feature.js").FeatureLike): VectorLayer<any>;
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
setHitTolerance(hitTolerance: number): void;
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private addFeature_;
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private removeFeature_;
|
||||
/**
|
||||
* @return {import("../style/Style.js").StyleLike|null} Select style.
|
||||
*/
|
||||
getStyle(): import("../style/Style.js").StyleLike | null;
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
private applySelectedStyle_;
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
private restorePreviousStyle_;
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private removeFeatureLayerAssociation_;
|
||||
}
|
||||
import Collection from "../Collection.js";
|
||||
import Interaction from "./Interaction.js";
|
||||
import VectorLayer from "../layer/Vector.js";
|
||||
//# sourceMappingURL=Select.d.ts.map
|
||||
1
node_modules/ol/interaction/Select.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Select.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../src/interaction/Select.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,kBANW,eAAe,YACf,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,cACtC,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,iEA2BhD;IApBC;;;;OAIG;IACH,UAHU,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CAGxB;IAExB;;;;OAIG;IACH,YAHU,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CAGpB;IAE5B;;;;OAIG;IACH,8DAAsC;CAEzC;;;;;;;;oCAhGqB,OAAO,eAAe,EAAE,WAAW,QAAE,OAAO,mBAAmB,EAAE,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,KAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8IAmBzE,OAAO,mBAAmB,EAAE,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,KAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAuFtI,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,eAAqB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC/D,OAAW,eAAe,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,GACtE,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GA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
generated
vendored
Normal file
530
node_modules/ol/interaction/Select.js
generated
vendored
Normal file
@@ -0,0 +1,530 @@
|
||||
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/interaction/Select
|
||||
*/
|
||||
import Collection from '../Collection.js';
|
||||
import CollectionEventType from '../CollectionEventType.js';
|
||||
import Event from '../events/Event.js';
|
||||
import Interaction from './Interaction.js';
|
||||
import VectorLayer from '../layer/Vector.js';
|
||||
import { TRUE } from '../functions.js';
|
||||
import { clear } from '../obj.js';
|
||||
import { createEditingStyle } from '../style/Style.js';
|
||||
import { extend, includes } from '../array.js';
|
||||
import { getUid } from '../util.js';
|
||||
import { never, shiftKeyOnly, singleClick } from '../events/condition.js';
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var SelectEventType = {
|
||||
/**
|
||||
* Triggered when feature(s) has been (de)selected.
|
||||
* @event SelectEvent#select
|
||||
* @api
|
||||
*/
|
||||
SELECT: 'select',
|
||||
};
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} or
|
||||
* {@link module:ol/render/Feature~RenderFeature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [addCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is the event
|
||||
* for the selected features as a whole. By default, this is
|
||||
* {@link module:ol/events/condition.singleClick}. Clicking on a feature selects that
|
||||
* feature and removes any that were in the selection. Clicking outside any
|
||||
* feature removes all from the selection.
|
||||
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
|
||||
* from the selection.
|
||||
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers]
|
||||
* A list of layers from which features should be selected. Alternatively, a
|
||||
* filter function can be provided. The function will be called for each layer
|
||||
* in the map and should return `true` for layers that you want to be
|
||||
* selectable. If the option is absent, all visible layers will be considered
|
||||
* selectable.
|
||||
* @property {import("../style/Style.js").StyleLike|null} [style]
|
||||
* Style for the selected features. By default the default edit style is used
|
||||
* (see {@link module:ol/style/Style~Style}). Set to `null` if this interaction should not apply
|
||||
* any style changes for selected features.
|
||||
* If set to a falsey value, the selected feature's style will not change.
|
||||
* @property {import("../events/condition.js").Condition} [removeCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
||||
* want to use different events for add and remove instead of `toggle`.
|
||||
* @property {import("../events/condition.js").Condition} [toggleCondition] A function
|
||||
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled. This is in addition
|
||||
* to the `condition` event. By default,
|
||||
* {@link module:ol/events/condition.shiftKeyOnly}, i.e. pressing `shift` as
|
||||
* well as the `condition` event, adds that feature to the current selection if
|
||||
* it is not currently selected, and removes it if it is. See `add` and `remove`
|
||||
* if you want to use different events instead of a toggle.
|
||||
* @property {boolean} [multi=false] A boolean that determines if the default
|
||||
* behaviour should select only single features or all (overlapping) features at
|
||||
* the clicked map position. The default of `false` means single select.
|
||||
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
|
||||
* Collection where the interaction will place selected features. Optional. If
|
||||
* not set the interaction will create a collection. In any case the collection
|
||||
* used by the interaction is returned by
|
||||
* {@link module:ol/interaction/Select~Select#getFeatures}.
|
||||
* @property {FilterFunction} [filter] A function
|
||||
* that takes an {@link module:ol/Feature~Feature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* selected or `false` otherwise.
|
||||
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside
|
||||
* the radius around the given position will be checked for features.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of
|
||||
* this type.
|
||||
*/
|
||||
var SelectEvent = /** @class */ (function (_super) {
|
||||
__extends(SelectEvent, _super);
|
||||
/**
|
||||
* @param {SelectEventType} type The event type.
|
||||
* @param {Array<import("../Feature.js").default>} selected Selected features.
|
||||
* @param {Array<import("../Feature.js").default>} deselected Deselected features.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated
|
||||
* {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
*/
|
||||
function SelectEvent(type, selected, deselected, mapBrowserEvent) {
|
||||
var _this = _super.call(this, type) || this;
|
||||
/**
|
||||
* Selected features array.
|
||||
* @type {Array<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
_this.selected = selected;
|
||||
/**
|
||||
* Deselected features array.
|
||||
* @type {Array<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
_this.deselected = deselected;
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
_this.mapBrowserEvent = mapBrowserEvent;
|
||||
return _this;
|
||||
}
|
||||
return SelectEvent;
|
||||
}(Event));
|
||||
export { SelectEvent };
|
||||
/**
|
||||
* Original feature styles to reset to when features are no longer selected.
|
||||
* @type {Object<number, import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction>}
|
||||
*/
|
||||
var originalFeatureStyles = {};
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'select', SelectEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'select', Return>} SelectOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for selecting vector features. By default, selected features are
|
||||
* styled differently, so this interaction can be used for visual highlighting,
|
||||
* as well as selecting features for other actions, such as modification or
|
||||
* output. There are three ways of controlling which features are selected:
|
||||
* using the browser event as defined by the `condition` and optionally the
|
||||
* `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
|
||||
* further feature filter using the `filter` option.
|
||||
*
|
||||
* @fires SelectEvent
|
||||
* @api
|
||||
*/
|
||||
var Select = /** @class */ (function (_super) {
|
||||
__extends(Select, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Select(opt_options) {
|
||||
var _this = _super.call(this) || this;
|
||||
/***
|
||||
* @type {SelectOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {SelectOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {SelectOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
var options = opt_options ? opt_options : {};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_this.boundAddFeature_ = _this.addFeature_.bind(_this);
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_this.boundRemoveFeature_ = _this.removeFeature_.bind(_this);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : singleClick;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.addCondition_ = options.addCondition ? options.addCondition : never;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.removeCondition_ = options.removeCondition
|
||||
? options.removeCondition
|
||||
: never;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.toggleCondition_ = options.toggleCondition
|
||||
? options.toggleCondition
|
||||
: shiftKeyOnly;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.multi_ = options.multi ? options.multi : false;
|
||||
/**
|
||||
* @private
|
||||
* @type {FilterFunction}
|
||||
*/
|
||||
_this.filter_ = options.filter ? options.filter : TRUE;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null}
|
||||
*/
|
||||
_this.style_ =
|
||||
options.style !== undefined ? options.style : getDefaultStyleFunction();
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../Collection.js").default}
|
||||
*/
|
||||
_this.features_ = options.features || new Collection();
|
||||
/** @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} */
|
||||
var layerFilter;
|
||||
if (options.layers) {
|
||||
if (typeof options.layers === 'function') {
|
||||
layerFilter = options.layers;
|
||||
}
|
||||
else {
|
||||
var layers_1 = options.layers;
|
||||
layerFilter = function (layer) {
|
||||
return includes(layers_1, layer);
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
layerFilter = TRUE;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
|
||||
*/
|
||||
_this.layerFilter_ = layerFilter;
|
||||
/**
|
||||
* An association between selected feature (key)
|
||||
* and layer (value)
|
||||
* @private
|
||||
* @type {Object<string, import("../layer/Layer.js").default>}
|
||||
*/
|
||||
_this.featureLayerAssociation_ = {};
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.addFeatureLayerAssociation_ = function (feature, layer) {
|
||||
this.featureLayerAssociation_[getUid(feature)] = layer;
|
||||
};
|
||||
/**
|
||||
* Get the selected features.
|
||||
* @return {import("../Collection.js").default<import("../Feature.js").default>} Features collection.
|
||||
* @api
|
||||
*/
|
||||
Select.prototype.getFeatures = function () {
|
||||
return this.features_;
|
||||
};
|
||||
/**
|
||||
* Returns the Hit-detection tolerance.
|
||||
* @return {number} Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
Select.prototype.getHitTolerance = function () {
|
||||
return this.hitTolerance_;
|
||||
};
|
||||
/**
|
||||
* Returns the associated {@link module:ol/layer/Vector~VectorLayer vector layer} of
|
||||
* a selected feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature
|
||||
* @return {import('../layer/Vector.js').default} Layer.
|
||||
* @api
|
||||
*/
|
||||
Select.prototype.getLayer = function (feature) {
|
||||
return /** @type {import('../layer/Vector.js').default} */ (this.featureLayerAssociation_[getUid(feature)]);
|
||||
};
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
Select.prototype.setHitTolerance = function (hitTolerance) {
|
||||
this.hitTolerance_ = hitTolerance;
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map, if any, and attach it to a new
|
||||
* map, if any. Pass `null` to just remove the interaction from the current map.
|
||||
* @param {import("../PluggableMap.js").default|null} map Map.
|
||||
* @api
|
||||
*/
|
||||
Select.prototype.setMap = function (map) {
|
||||
var currentMap = this.getMap();
|
||||
if (currentMap && this.style_) {
|
||||
this.features_.forEach(this.restorePreviousStyle_.bind(this));
|
||||
}
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
this.features_.addEventListener(CollectionEventType.ADD, this.boundAddFeature_);
|
||||
this.features_.addEventListener(CollectionEventType.REMOVE, this.boundRemoveFeature_);
|
||||
if (this.style_) {
|
||||
this.features_.forEach(this.applySelectedStyle_.bind(this));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.features_.removeEventListener(CollectionEventType.ADD, this.boundAddFeature_);
|
||||
this.features_.removeEventListener(CollectionEventType.REMOVE, this.boundRemoveFeature_);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.addFeature_ = function (evt) {
|
||||
var feature = evt.element;
|
||||
if (this.style_) {
|
||||
this.applySelectedStyle_(feature);
|
||||
}
|
||||
if (!this.getLayer(feature)) {
|
||||
var layer = /** @type {VectorLayer} */ (this.getMap()
|
||||
.getAllLayers()
|
||||
.find(function (layer) {
|
||||
if (layer instanceof VectorLayer &&
|
||||
layer.getSource() &&
|
||||
layer.getSource().hasFeature(feature)) {
|
||||
return layer;
|
||||
}
|
||||
}));
|
||||
if (layer) {
|
||||
this.addFeatureLayerAssociation_(feature, layer);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.removeFeature_ = function (evt) {
|
||||
var feature = evt.element;
|
||||
if (this.style_) {
|
||||
this.restorePreviousStyle_(feature);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @return {import("../style/Style.js").StyleLike|null} Select style.
|
||||
*/
|
||||
Select.prototype.getStyle = function () {
|
||||
return this.style_;
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.applySelectedStyle_ = function (feature) {
|
||||
var key = getUid(feature);
|
||||
if (!(key in originalFeatureStyles)) {
|
||||
originalFeatureStyles[key] = feature.getStyle();
|
||||
}
|
||||
feature.setStyle(this.style_);
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.restorePreviousStyle_ = function (feature) {
|
||||
var interactions = this.getMap().getInteractions().getArray();
|
||||
for (var i = interactions.length - 1; i >= 0; --i) {
|
||||
var interaction = interactions[i];
|
||||
if (interaction !== this &&
|
||||
interaction instanceof Select &&
|
||||
interaction.getStyle() &&
|
||||
interaction.getFeatures().getArray().lastIndexOf(feature) !== -1) {
|
||||
feature.setStyle(interaction.getStyle());
|
||||
return;
|
||||
}
|
||||
}
|
||||
var key = getUid(feature);
|
||||
feature.setStyle(originalFeatureStyles[key]);
|
||||
delete originalFeatureStyles[key];
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
Select.prototype.removeFeatureLayerAssociation_ = function (feature) {
|
||||
delete this.featureLayerAssociation_[getUid(feature)];
|
||||
};
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may change the
|
||||
* selected state of features.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @this {Select}
|
||||
*/
|
||||
Select.prototype.handleEvent = function (mapBrowserEvent) {
|
||||
if (!this.condition_(mapBrowserEvent)) {
|
||||
return true;
|
||||
}
|
||||
var add = this.addCondition_(mapBrowserEvent);
|
||||
var remove = this.removeCondition_(mapBrowserEvent);
|
||||
var toggle = this.toggleCondition_(mapBrowserEvent);
|
||||
var set = !add && !remove && !toggle;
|
||||
var map = mapBrowserEvent.map;
|
||||
var features = this.getFeatures();
|
||||
var deselected = [];
|
||||
var selected = [];
|
||||
if (set) {
|
||||
// Replace the currently selected feature(s) with the feature(s) at the
|
||||
// pixel, or clear the selected feature(s) if there is no feature at
|
||||
// the pixel.
|
||||
clear(this.featureLayerAssociation_);
|
||||
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @return {boolean|undefined} Continue to iterate over the features.
|
||||
*/
|
||||
function (feature, layer) {
|
||||
if (this.filter_(feature, layer)) {
|
||||
this.addFeatureLayerAssociation_(feature, layer);
|
||||
selected.push(feature);
|
||||
return !this.multi_;
|
||||
}
|
||||
}.bind(this), {
|
||||
layerFilter: this.layerFilter_,
|
||||
hitTolerance: this.hitTolerance_,
|
||||
});
|
||||
for (var i = features.getLength() - 1; i >= 0; --i) {
|
||||
var feature = features.item(i);
|
||||
var index = selected.indexOf(feature);
|
||||
if (index > -1) {
|
||||
// feature is already selected
|
||||
selected.splice(index, 1);
|
||||
}
|
||||
else {
|
||||
features.remove(feature);
|
||||
deselected.push(feature);
|
||||
}
|
||||
}
|
||||
if (selected.length !== 0) {
|
||||
features.extend(selected);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Modify the currently selected feature(s).
|
||||
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @return {boolean|undefined} Continue to iterate over the features.
|
||||
*/
|
||||
function (feature, layer) {
|
||||
if (this.filter_(feature, layer)) {
|
||||
if ((add || toggle) && !includes(features.getArray(), feature)) {
|
||||
this.addFeatureLayerAssociation_(feature, layer);
|
||||
selected.push(feature);
|
||||
}
|
||||
else if ((remove || toggle) &&
|
||||
includes(features.getArray(), feature)) {
|
||||
deselected.push(feature);
|
||||
this.removeFeatureLayerAssociation_(feature);
|
||||
}
|
||||
return !this.multi_;
|
||||
}
|
||||
}.bind(this), {
|
||||
layerFilter: this.layerFilter_,
|
||||
hitTolerance: this.hitTolerance_,
|
||||
});
|
||||
for (var j = deselected.length - 1; j >= 0; --j) {
|
||||
features.remove(deselected[j]);
|
||||
}
|
||||
features.extend(selected);
|
||||
}
|
||||
if (selected.length > 0 || deselected.length > 0) {
|
||||
this.dispatchEvent(new SelectEvent(SelectEventType.SELECT, selected, deselected, mapBrowserEvent));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return Select;
|
||||
}(Interaction));
|
||||
/**
|
||||
* @return {import("../style/Style.js").StyleFunction} Styles.
|
||||
*/
|
||||
function getDefaultStyleFunction() {
|
||||
var styles = createEditingStyle();
|
||||
extend(styles['Polygon'], styles['LineString']);
|
||||
extend(styles['GeometryCollection'], styles['LineString']);
|
||||
return function (feature) {
|
||||
if (!feature.getGeometry()) {
|
||||
return null;
|
||||
}
|
||||
return styles[feature.getGeometry().getType()];
|
||||
};
|
||||
}
|
||||
export default Select;
|
||||
//# sourceMappingURL=Select.js.map
|
||||
1
node_modules/ol/interaction/Select.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Select.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
250
node_modules/ol/interaction/Snap.d.ts
generated
vendored
Normal file
250
node_modules/ol/interaction/Snap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
export default Snap;
|
||||
export type Result = {
|
||||
/**
|
||||
* Vertex.
|
||||
*/
|
||||
vertex: import("../coordinate.js").Coordinate | null;
|
||||
/**
|
||||
* VertexPixel.
|
||||
*/
|
||||
vertexPixel: import("../pixel.js").Pixel | null;
|
||||
};
|
||||
export type SegmentData = {
|
||||
/**
|
||||
* Feature.
|
||||
*/
|
||||
feature: import("../Feature.js").default;
|
||||
/**
|
||||
* Segment.
|
||||
*/
|
||||
segment: Array<import("../coordinate.js").Coordinate>;
|
||||
};
|
||||
export type Options = {
|
||||
/**
|
||||
* Snap to these features. Either this option or source should be provided.
|
||||
*/
|
||||
features?: import("../Collection.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
|
||||
/**
|
||||
* Snap to edges.
|
||||
*/
|
||||
edge?: boolean | undefined;
|
||||
/**
|
||||
* Snap to vertices.
|
||||
*/
|
||||
vertex?: boolean | undefined;
|
||||
/**
|
||||
* Pixel tolerance for considering the pointer close enough to a segment or
|
||||
* vertex for snapping.
|
||||
*/
|
||||
pixelTolerance?: number | undefined;
|
||||
/**
|
||||
* Snap to features from this source. Either this option or features should be provided
|
||||
*/
|
||||
source?: import("../source/Vector.js").default<import("../geom/Geometry.js").default> | undefined;
|
||||
};
|
||||
/**
|
||||
* @classdesc
|
||||
* Handles snapping of vector features while modifying or drawing them. The
|
||||
* features can come from a {@link module:ol/source/Vector~VectorSource} or {@link module:ol/Collection~Collection}
|
||||
* Any interaction object that allows the user to interact
|
||||
* with the features using the mouse can benefit from the snapping, as long
|
||||
* as it is added before.
|
||||
*
|
||||
* The snap interaction modifies map browser event `coordinate` and `pixel`
|
||||
* properties to force the snap to occur to any interaction that them.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* import Snap from 'ol/interaction/Snap';
|
||||
*
|
||||
* const snap = new Snap({
|
||||
* source: source
|
||||
* });
|
||||
*
|
||||
* map.addInteraction(snap);
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Snap extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @type {import("../source/Vector.js").default|null}
|
||||
* @private
|
||||
*/
|
||||
private source_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private vertex_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private edge_;
|
||||
/**
|
||||
* @type {import("../Collection.js").default<import("../Feature.js").default>|null}
|
||||
* @private
|
||||
*/
|
||||
private features_;
|
||||
/**
|
||||
* @type {Array<import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
private featuresListenerKeys_;
|
||||
/**
|
||||
* @type {Object<string, import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
private featureChangeListenerKeys_;
|
||||
/**
|
||||
* Extents are preserved so indexed segment can be quickly removed
|
||||
* when its feature geometry changes
|
||||
* @type {Object<string, import("../extent.js").Extent>}
|
||||
* @private
|
||||
*/
|
||||
private indexedFeaturesExtents_;
|
||||
/**
|
||||
* If a feature geometry changes while a pointer drag|move event occurs, the
|
||||
* feature doesn't get updated right away. It will be at the next 'pointerup'
|
||||
* event fired.
|
||||
* @type {!Object<string, import("../Feature.js").default>}
|
||||
* @private
|
||||
*/
|
||||
private pendingFeatures_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private pixelTolerance_;
|
||||
/**
|
||||
* Segment RTree for each layer
|
||||
* @type {import("../structs/RBush.js").default<SegmentData>}
|
||||
* @private
|
||||
*/
|
||||
private rBush_;
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {Object<string, function(Array<Array<import('../coordinate.js').Coordinate>>, import("../geom/Geometry.js").default): void>}
|
||||
*/
|
||||
private GEOMETRY_SEGMENTERS_;
|
||||
/**
|
||||
* Add a feature to the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @param {boolean} [opt_listen] Whether to listen to the feature change or not
|
||||
* Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
addFeature(feature: import("../Feature.js").default, opt_listen?: boolean | undefined): void;
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private forEachFeatureAdd_;
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
private forEachFeatureRemove_;
|
||||
/**
|
||||
* @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features.
|
||||
* @private
|
||||
*/
|
||||
private getFeatures_;
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureAdd_;
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureRemove_;
|
||||
/**
|
||||
* @param {import("../events/Event.js").default} evt Event.
|
||||
* @private
|
||||
*/
|
||||
private handleFeatureChange_;
|
||||
/**
|
||||
* Remove a feature from the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @param {boolean} [opt_unlisten] Whether to unlisten to the feature change
|
||||
* or not. Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
removeFeature(feature: import("../Feature.js").default, opt_unlisten?: boolean | undefined): void;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel
|
||||
* @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @return {Result|null} Snap result
|
||||
*/
|
||||
snapTo(pixel: import("../pixel.js").Pixel, pixelCoordinate: import("../coordinate.js").Coordinate, map: import("../PluggableMap.js").default): Result | null;
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
private updateFeature_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Circle.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentCircleGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentGeometryCollectionGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/LineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentLineStringGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiLineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentMultiLineStringGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiPoint.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentMultiPointGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentMultiPolygonGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Point.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentPointGeometry_;
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Polygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
private segmentPolygonGeometry_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=Snap.d.ts.map
|
||||
1
node_modules/ol/interaction/Snap.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Snap.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Snap.d.ts","sourceRoot":"","sources":["../src/interaction/Snap.js"],"names":[],"mappings":";;;;;YA2Bc,OAAO,kBAAkB,EAAE,UAAU,GAAC,IAAI;;;;iBAC1C,OAAO,aAAa,EAAE,KAAK,GAAC,IAAI;;;;;;aAKhC,OAAO,eAAe,EAAE,OAAO;;;;aAC/B,MAAM,OAAO,kBAAkB,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAkC1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IACE;;OAEG;IACH,+CAoGC;IAnFC;;;OAGG;IACH,gBAAqD;IAErD;;;OAGG;IACH,gBAAmE;IAEnE;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,kBAA2D;IAE3D;;;OAGG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,mCAAoC;IAEpC;;;;;OAKG;IACH,gCAAiC;IAEjC;;;;;;OAMG;IACH,yBAA0B;IAE1B;;;OAGG;IACH,wBACoE;IAEpE;;;;OAIG;IACH,eAAyB;IAEzB;;;;OAIG;IACH,6BAUC;IAGH;;;;;;OAMG;IACH,oBALW,OAAO,eAAe,EAAE,OAAO,0CA0CzC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,8BAEC;IAED;;;OAGG;IACH,qBAQC;IAeD;;;OAGG;IACH,0BAGC;IAED;;;OAGG;IACH,6BAGC;IAED;;;OAGG;IACH,6BAUC;IAgBD;;;;;;OAMG;IACH,uBALW,OAAO,eAAe,EAAE,OAAO,4CA0BzC;IAED;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAkD9C;IAED;;;;;OAKG;IACH,cALW,OAAO,aAAa,EAAE,KAAK,mBAC3B,OAAO,kBAAkB,EAAE,UAAU,OACrC,OAAO,oBAAoB,EAAE,OAAO,GACnC,MAAM,GAAC,IAAI,CA8GtB;IAED;;;OAGG;IACH,uBAGC;IAED;;;;OAIG;IACH,+BAiBC;IAED;;;;OAIG;IACH,2CAQC;IAED;;;;OAIG;IACH,mCAKC;IAED;;;;OAIG;IACH,wCAQC;IAED;;;;OAIG;IACH,mCAIC;IAED;;;;OAIG;IACH,qCAWC;IAED;;;;OAIG;IACH,8BAEC;IAED;;;;OAIG;IACH,gCAQC;CACF"}
|
||||
579
node_modules/ol/interaction/Snap.js
generated
vendored
Normal file
579
node_modules/ol/interaction/Snap.js
generated
vendored
Normal file
@@ -0,0 +1,579 @@
|
||||
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/interaction/Snap
|
||||
*/
|
||||
import CollectionEventType from '../CollectionEventType.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import RBush from '../structs/RBush.js';
|
||||
import VectorEventType from '../source/VectorEventType.js';
|
||||
import { FALSE, TRUE } from '../functions.js';
|
||||
import { boundingExtent, createEmpty } from '../extent.js';
|
||||
import { closestOnCircle, closestOnSegment, squaredDistance, } from '../coordinate.js';
|
||||
import { fromCircle } from '../geom/Polygon.js';
|
||||
import { fromUserCoordinate, getUserProjection, toUserCoordinate, } from '../proj.js';
|
||||
import { getUid } from '../util.js';
|
||||
import { getValues } from '../obj.js';
|
||||
import { listen, unlistenByKey } from '../events.js';
|
||||
/**
|
||||
* @typedef {Object} Result
|
||||
* @property {import("../coordinate.js").Coordinate|null} vertex Vertex.
|
||||
* @property {import("../pixel.js").Pixel|null} vertexPixel VertexPixel.
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} SegmentData
|
||||
* @property {import("../Feature.js").default} feature Feature.
|
||||
* @property {Array<import("../coordinate.js").Coordinate>} segment Segment.
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../Collection.js").default<import("../Feature.js").default>} [features] Snap to these features. Either this option or source should be provided.
|
||||
* @property {boolean} [edge=true] Snap to edges.
|
||||
* @property {boolean} [vertex=true] Snap to vertices.
|
||||
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or
|
||||
* vertex for snapping.
|
||||
* @property {import("../source/Vector.js").default} [source] Snap to features from this source. Either this option or features should be provided
|
||||
*/
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @return {import("../Feature.js").default} Feature.
|
||||
*/
|
||||
function getFeatureFromEvent(evt) {
|
||||
if (
|
||||
/** @type {import("../source/Vector.js").VectorSourceEvent} */ (evt).feature) {
|
||||
return /** @type {import("../source/Vector.js").VectorSourceEvent} */ (evt)
|
||||
.feature;
|
||||
}
|
||||
else if (
|
||||
/** @type {import("../Collection.js").CollectionEvent} */ (evt).element) {
|
||||
return /** @type {import("../Feature.js").default} */ (
|
||||
/** @type {import("../Collection.js").CollectionEvent} */ (evt).element);
|
||||
}
|
||||
}
|
||||
var tempSegment = [];
|
||||
/**
|
||||
* @classdesc
|
||||
* Handles snapping of vector features while modifying or drawing them. The
|
||||
* features can come from a {@link module:ol/source/Vector~VectorSource} or {@link module:ol/Collection~Collection}
|
||||
* Any interaction object that allows the user to interact
|
||||
* with the features using the mouse can benefit from the snapping, as long
|
||||
* as it is added before.
|
||||
*
|
||||
* The snap interaction modifies map browser event `coordinate` and `pixel`
|
||||
* properties to force the snap to occur to any interaction that them.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* import Snap from 'ol/interaction/Snap';
|
||||
*
|
||||
* const snap = new Snap({
|
||||
* source: source
|
||||
* });
|
||||
*
|
||||
* map.addInteraction(snap);
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Snap = /** @class */ (function (_super) {
|
||||
__extends(Snap, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Snap(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
|
||||
if (!pointerOptions.handleDownEvent) {
|
||||
pointerOptions.handleDownEvent = TRUE;
|
||||
}
|
||||
if (!pointerOptions.stopDown) {
|
||||
pointerOptions.stopDown = FALSE;
|
||||
}
|
||||
_this = _super.call(this, pointerOptions) || this;
|
||||
/**
|
||||
* @type {import("../source/Vector.js").default|null}
|
||||
* @private
|
||||
*/
|
||||
_this.source_ = options.source ? options.source : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.vertex_ = options.vertex !== undefined ? options.vertex : true;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
_this.edge_ = options.edge !== undefined ? options.edge : true;
|
||||
/**
|
||||
* @type {import("../Collection.js").default<import("../Feature.js").default>|null}
|
||||
* @private
|
||||
*/
|
||||
_this.features_ = options.features ? options.features : null;
|
||||
/**
|
||||
* @type {Array<import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
_this.featuresListenerKeys_ = [];
|
||||
/**
|
||||
* @type {Object<string, import("../events.js").EventsKey>}
|
||||
* @private
|
||||
*/
|
||||
_this.featureChangeListenerKeys_ = {};
|
||||
/**
|
||||
* Extents are preserved so indexed segment can be quickly removed
|
||||
* when its feature geometry changes
|
||||
* @type {Object<string, import("../extent.js").Extent>}
|
||||
* @private
|
||||
*/
|
||||
_this.indexedFeaturesExtents_ = {};
|
||||
/**
|
||||
* If a feature geometry changes while a pointer drag|move event occurs, the
|
||||
* feature doesn't get updated right away. It will be at the next 'pointerup'
|
||||
* event fired.
|
||||
* @type {!Object<string, import("../Feature.js").default>}
|
||||
* @private
|
||||
*/
|
||||
_this.pendingFeatures_ = {};
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
_this.pixelTolerance_ =
|
||||
options.pixelTolerance !== undefined ? options.pixelTolerance : 10;
|
||||
/**
|
||||
* Segment RTree for each layer
|
||||
* @type {import("../structs/RBush.js").default<SegmentData>}
|
||||
* @private
|
||||
*/
|
||||
_this.rBush_ = new RBush();
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {Object<string, function(Array<Array<import('../coordinate.js').Coordinate>>, import("../geom/Geometry.js").default): void>}
|
||||
*/
|
||||
_this.GEOMETRY_SEGMENTERS_ = {
|
||||
'Point': _this.segmentPointGeometry_.bind(_this),
|
||||
'LineString': _this.segmentLineStringGeometry_.bind(_this),
|
||||
'LinearRing': _this.segmentLineStringGeometry_.bind(_this),
|
||||
'Polygon': _this.segmentPolygonGeometry_.bind(_this),
|
||||
'MultiPoint': _this.segmentMultiPointGeometry_.bind(_this),
|
||||
'MultiLineString': _this.segmentMultiLineStringGeometry_.bind(_this),
|
||||
'MultiPolygon': _this.segmentMultiPolygonGeometry_.bind(_this),
|
||||
'GeometryCollection': _this.segmentGeometryCollectionGeometry_.bind(_this),
|
||||
'Circle': _this.segmentCircleGeometry_.bind(_this),
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Add a feature to the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @param {boolean} [opt_listen] Whether to listen to the feature change or not
|
||||
* Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
Snap.prototype.addFeature = function (feature, opt_listen) {
|
||||
var register = opt_listen !== undefined ? opt_listen : true;
|
||||
var feature_uid = getUid(feature);
|
||||
var geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
var segmenter = this.GEOMETRY_SEGMENTERS_[geometry.getType()];
|
||||
if (segmenter) {
|
||||
this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent(createEmpty());
|
||||
var segments =
|
||||
/** @type {Array<Array<import('../coordinate.js').Coordinate>>} */ ([]);
|
||||
segmenter(segments, geometry);
|
||||
if (segments.length === 1) {
|
||||
this.rBush_.insert(boundingExtent(segments[0]), {
|
||||
feature: feature,
|
||||
segment: segments[0],
|
||||
});
|
||||
}
|
||||
else if (segments.length > 1) {
|
||||
var extents = segments.map(function (s) { return boundingExtent(s); });
|
||||
var segmentsData = segments.map(function (segment) { return ({
|
||||
feature: feature,
|
||||
segment: segment,
|
||||
}); });
|
||||
this.rBush_.load(extents, segmentsData);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (register) {
|
||||
this.featureChangeListenerKeys_[feature_uid] = listen(feature, EventType.CHANGE, this.handleFeatureChange_, this);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.forEachFeatureAdd_ = function (feature) {
|
||||
this.addFeature(feature);
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.forEachFeatureRemove_ = function (feature) {
|
||||
this.removeFeature(feature);
|
||||
};
|
||||
/**
|
||||
* @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.getFeatures_ = function () {
|
||||
var features;
|
||||
if (this.features_) {
|
||||
features = this.features_;
|
||||
}
|
||||
else if (this.source_) {
|
||||
features = this.source_.getFeatures();
|
||||
}
|
||||
return features;
|
||||
};
|
||||
/**
|
||||
* @param {import("../MapBrowserEvent.js").default} evt Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
Snap.prototype.handleEvent = function (evt) {
|
||||
var result = this.snapTo(evt.pixel, evt.coordinate, evt.map);
|
||||
if (result) {
|
||||
evt.coordinate = result.vertex.slice(0, 2);
|
||||
evt.pixel = result.vertexPixel;
|
||||
}
|
||||
return _super.prototype.handleEvent.call(this, evt);
|
||||
};
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.handleFeatureAdd_ = function (evt) {
|
||||
var feature = getFeatureFromEvent(evt);
|
||||
this.addFeature(feature);
|
||||
};
|
||||
/**
|
||||
* @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.handleFeatureRemove_ = function (evt) {
|
||||
var feature = getFeatureFromEvent(evt);
|
||||
this.removeFeature(feature);
|
||||
};
|
||||
/**
|
||||
* @param {import("../events/Event.js").default} evt Event.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.handleFeatureChange_ = function (evt) {
|
||||
var feature = /** @type {import("../Feature.js").default} */ (evt.target);
|
||||
if (this.handlingDownUpSequence) {
|
||||
var uid = getUid(feature);
|
||||
if (!(uid in this.pendingFeatures_)) {
|
||||
this.pendingFeatures_[uid] = feature;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.updateFeature_(feature);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} evt Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
Snap.prototype.handleUpEvent = function (evt) {
|
||||
var featuresToUpdate = getValues(this.pendingFeatures_);
|
||||
if (featuresToUpdate.length) {
|
||||
featuresToUpdate.forEach(this.updateFeature_.bind(this));
|
||||
this.pendingFeatures_ = {};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Remove a feature from the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @param {boolean} [opt_unlisten] Whether to unlisten to the feature change
|
||||
* or not. Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
Snap.prototype.removeFeature = function (feature, opt_unlisten) {
|
||||
var unregister = opt_unlisten !== undefined ? opt_unlisten : true;
|
||||
var feature_uid = getUid(feature);
|
||||
var extent = this.indexedFeaturesExtents_[feature_uid];
|
||||
if (extent) {
|
||||
var rBush = this.rBush_;
|
||||
var nodesToRemove_1 = [];
|
||||
rBush.forEachInExtent(extent, function (node) {
|
||||
if (feature === node.feature) {
|
||||
nodesToRemove_1.push(node);
|
||||
}
|
||||
});
|
||||
for (var i = nodesToRemove_1.length - 1; i >= 0; --i) {
|
||||
rBush.remove(nodesToRemove_1[i]);
|
||||
}
|
||||
}
|
||||
if (unregister) {
|
||||
unlistenByKey(this.featureChangeListenerKeys_[feature_uid]);
|
||||
delete this.featureChangeListenerKeys_[feature_uid];
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
Snap.prototype.setMap = function (map) {
|
||||
var currentMap = this.getMap();
|
||||
var keys = this.featuresListenerKeys_;
|
||||
var features = /** @type {Array<import("../Feature.js").default>} */ (this.getFeatures_());
|
||||
if (currentMap) {
|
||||
keys.forEach(unlistenByKey);
|
||||
keys.length = 0;
|
||||
features.forEach(this.forEachFeatureRemove_.bind(this));
|
||||
}
|
||||
_super.prototype.setMap.call(this, map);
|
||||
if (map) {
|
||||
if (this.features_) {
|
||||
keys.push(listen(this.features_, CollectionEventType.ADD, this.handleFeatureAdd_, this), listen(this.features_, CollectionEventType.REMOVE, this.handleFeatureRemove_, this));
|
||||
}
|
||||
else if (this.source_) {
|
||||
keys.push(listen(this.source_, VectorEventType.ADDFEATURE, this.handleFeatureAdd_, this), listen(this.source_, VectorEventType.REMOVEFEATURE, this.handleFeatureRemove_, this));
|
||||
}
|
||||
features.forEach(this.forEachFeatureAdd_.bind(this));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel
|
||||
* @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
* @return {Result|null} Snap result
|
||||
*/
|
||||
Snap.prototype.snapTo = function (pixel, pixelCoordinate, map) {
|
||||
var lowerLeft = map.getCoordinateFromPixel([
|
||||
pixel[0] - this.pixelTolerance_,
|
||||
pixel[1] + this.pixelTolerance_,
|
||||
]);
|
||||
var upperRight = map.getCoordinateFromPixel([
|
||||
pixel[0] + this.pixelTolerance_,
|
||||
pixel[1] - this.pixelTolerance_,
|
||||
]);
|
||||
var box = boundingExtent([lowerLeft, upperRight]);
|
||||
var segments = this.rBush_.getInExtent(box);
|
||||
var segmentsLength = segments.length;
|
||||
if (segmentsLength === 0) {
|
||||
return null;
|
||||
}
|
||||
var projection = map.getView().getProjection();
|
||||
var projectedCoordinate = fromUserCoordinate(pixelCoordinate, projection);
|
||||
var closestVertex;
|
||||
var minSquaredDistance = Infinity;
|
||||
var squaredPixelTolerance = this.pixelTolerance_ * this.pixelTolerance_;
|
||||
var getResult = function () {
|
||||
if (closestVertex) {
|
||||
var vertexPixel = map.getPixelFromCoordinate(closestVertex);
|
||||
var squaredPixelDistance = squaredDistance(pixel, vertexPixel);
|
||||
if (squaredPixelDistance <= squaredPixelTolerance) {
|
||||
return {
|
||||
vertex: closestVertex,
|
||||
vertexPixel: [
|
||||
Math.round(vertexPixel[0]),
|
||||
Math.round(vertexPixel[1]),
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
if (this.vertex_) {
|
||||
for (var i = 0; i < segmentsLength; ++i) {
|
||||
var segmentData = segments[i];
|
||||
if (segmentData.feature.getGeometry().getType() !== 'Circle') {
|
||||
segmentData.segment.forEach(function (vertex) {
|
||||
var tempVertexCoord = fromUserCoordinate(vertex, projection);
|
||||
var delta = squaredDistance(projectedCoordinate, tempVertexCoord);
|
||||
if (delta < minSquaredDistance) {
|
||||
closestVertex = vertex;
|
||||
minSquaredDistance = delta;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var result = getResult();
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (this.edge_) {
|
||||
for (var i = 0; i < segmentsLength; ++i) {
|
||||
var vertex = null;
|
||||
var segmentData = segments[i];
|
||||
if (segmentData.feature.getGeometry().getType() === 'Circle') {
|
||||
var circleGeometry = segmentData.feature.getGeometry();
|
||||
var userProjection = getUserProjection();
|
||||
if (userProjection) {
|
||||
circleGeometry = circleGeometry
|
||||
.clone()
|
||||
.transform(userProjection, projection);
|
||||
}
|
||||
vertex = toUserCoordinate(closestOnCircle(projectedCoordinate,
|
||||
/** @type {import("../geom/Circle.js").default} */ (circleGeometry)), projection);
|
||||
}
|
||||
else {
|
||||
var _a = segmentData.segment, segmentStart = _a[0], segmentEnd = _a[1];
|
||||
// points have only one coordinate
|
||||
if (segmentEnd) {
|
||||
tempSegment[0] = fromUserCoordinate(segmentStart, projection);
|
||||
tempSegment[1] = fromUserCoordinate(segmentEnd, projection);
|
||||
vertex = closestOnSegment(projectedCoordinate, tempSegment);
|
||||
}
|
||||
}
|
||||
if (vertex) {
|
||||
var delta = squaredDistance(projectedCoordinate, vertex);
|
||||
if (delta < minSquaredDistance) {
|
||||
closestVertex = vertex;
|
||||
minSquaredDistance = delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
var result = getResult();
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.updateFeature_ = function (feature) {
|
||||
this.removeFeature(feature, false);
|
||||
this.addFeature(feature, false);
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Circle.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentCircleGeometry_ = function (segments, geometry) {
|
||||
var projection = this.getMap().getView().getProjection();
|
||||
var circleGeometry = geometry;
|
||||
var userProjection = getUserProjection();
|
||||
if (userProjection) {
|
||||
circleGeometry = /** @type {import("../geom/Circle.js").default} */ (circleGeometry.clone().transform(userProjection, projection));
|
||||
}
|
||||
var polygon = fromCircle(circleGeometry);
|
||||
if (userProjection) {
|
||||
polygon.transform(projection, userProjection);
|
||||
}
|
||||
var coordinates = polygon.getCoordinates()[0];
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segments.push(coordinates.slice(i, i + 2));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentGeometryCollectionGeometry_ = function (segments, geometry) {
|
||||
var geometries = geometry.getGeometriesArray();
|
||||
for (var i = 0; i < geometries.length; ++i) {
|
||||
var segmenter = this.GEOMETRY_SEGMENTERS_[geometries[i].getType()];
|
||||
if (segmenter) {
|
||||
segmenter(segments, geometries[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/LineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentLineStringGeometry_ = function (segments, geometry) {
|
||||
var coordinates = geometry.getCoordinates();
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segments.push(coordinates.slice(i, i + 2));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiLineString.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentMultiLineStringGeometry_ = function (segments, geometry) {
|
||||
var lines = geometry.getCoordinates();
|
||||
for (var j = 0, jj = lines.length; j < jj; ++j) {
|
||||
var coordinates = lines[j];
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segments.push(coordinates.slice(i, i + 2));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiPoint.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentMultiPointGeometry_ = function (segments, geometry) {
|
||||
geometry.getCoordinates().forEach(function (point) {
|
||||
segments.push([point]);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentMultiPolygonGeometry_ = function (segments, geometry) {
|
||||
var polygons = geometry.getCoordinates();
|
||||
for (var k = 0, kk = polygons.length; k < kk; ++k) {
|
||||
var rings = polygons[k];
|
||||
for (var j = 0, jj = rings.length; j < jj; ++j) {
|
||||
var coordinates = rings[j];
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segments.push(coordinates.slice(i, i + 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Point.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentPointGeometry_ = function (segments, geometry) {
|
||||
segments.push([geometry.getCoordinates()]);
|
||||
};
|
||||
/**
|
||||
* @param {Array<Array<import('../coordinate.js').Coordinate>>} segments Segments
|
||||
* @param {import("../geom/Polygon.js").default} geometry Geometry.
|
||||
* @private
|
||||
*/
|
||||
Snap.prototype.segmentPolygonGeometry_ = function (segments, geometry) {
|
||||
var rings = geometry.getCoordinates();
|
||||
for (var j = 0, jj = rings.length; j < jj; ++j) {
|
||||
var coordinates = rings[j];
|
||||
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||
segments.push(coordinates.slice(i, i + 2));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Snap;
|
||||
}(PointerInteraction));
|
||||
export default Snap;
|
||||
//# sourceMappingURL=Snap.js.map
|
||||
1
node_modules/ol/interaction/Snap.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Snap.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
242
node_modules/ol/interaction/Translate.d.ts
generated
vendored
Normal file
242
node_modules/ol/interaction/Translate.d.ts
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} or
|
||||
* {@link module:ol/render/Feature~RenderFeature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise.
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.always}.
|
||||
* @property {Collection<import("../Feature.js").default>} [features] Features contained in this collection will be able to be translated together.
|
||||
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers] A list of layers from which features should be
|
||||
* translated. Alternatively, a filter function can be provided. The
|
||||
* function will be called for each layer in the map and should return
|
||||
* `true` for layers that you want to be translatable. If the option is
|
||||
* absent, all visible layers will be considered translatable.
|
||||
* Not used if `features` is provided.
|
||||
* @property {FilterFunction} [filter] A function
|
||||
* that takes an {@link module:ol/Feature~Feature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise. Not used if `features` is provided.
|
||||
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Translate~Translate} instances
|
||||
* are instances of this type.
|
||||
*/
|
||||
export class TranslateEvent extends Event {
|
||||
/**
|
||||
* @param {TranslateEventType} type Type.
|
||||
* @param {Collection<import("../Feature.js").default>} features The features translated.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
*/
|
||||
constructor(type: TranslateEventType, features: Collection<import("../Feature.js").default>, coordinate: import("../coordinate.js").Coordinate, startCoordinate: import("../coordinate.js").Coordinate, mapBrowserEvent: import("../MapBrowserEvent.js").default<any>);
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {Collection<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
features: Collection<import("../Feature.js").default>;
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
coordinate: import("../coordinate.js").Coordinate;
|
||||
/**
|
||||
* The coordinate of the start position before translation started.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
startCoordinate: import("../coordinate.js").Coordinate;
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
mapBrowserEvent: import("../MapBrowserEvent.js").default<any>;
|
||||
}
|
||||
export default Translate;
|
||||
/**
|
||||
* A function that takes an {@link module :ol/Feature~Feature} or
|
||||
* {@link module :ol/render/Feature~RenderFeature} and an
|
||||
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise.
|
||||
*/
|
||||
export type FilterFunction = (arg0: import("../Feature.js").FeatureLike, arg1: import("../layer/Layer.js").default<import("../source/Source").default>) => boolean;
|
||||
export type Options = {
|
||||
/**
|
||||
* A function that
|
||||
* takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module :ol/events/condition.always}.
|
||||
*/
|
||||
condition?: import("../events/condition.js").Condition | undefined;
|
||||
/**
|
||||
* Features contained in this collection will be able to be translated together.
|
||||
*/
|
||||
features?: Collection<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
|
||||
/**
|
||||
* A list of layers from which features should be
|
||||
* translated. Alternatively, a filter function can be provided. The
|
||||
* function will be called for each layer in the map and should return
|
||||
* `true` for layers that you want to be translatable. If the option is
|
||||
* absent, all visible layers will be considered translatable.
|
||||
* Not used if `features` is provided.
|
||||
*/
|
||||
layers?: import("../layer/Layer.js").default<import("../source/Source").default, import("../renderer/Layer.js").default<any>>[] | ((arg0: import("../layer/Layer.js").default<import("../source/Source").default>) => boolean) | undefined;
|
||||
/**
|
||||
* A function
|
||||
* that takes an {@link module :ol/Feature~Feature} and an
|
||||
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise. Not used if `features` is provided.
|
||||
*/
|
||||
filter?: FilterFunction | undefined;
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
*/
|
||||
hitTolerance?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* *
|
||||
*/
|
||||
export type TranslateOnSignature<Return> = import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> & import("../Observable").OnSignature<import("../ObjectEventType").Types | 'change:active', import("../Object").ObjectEvent, Return> & import("../Observable").OnSignature<'translateend' | 'translatestart' | 'translating', TranslateEvent, Return> & import("../Observable").CombinedOnSignature<import("../Observable").EventTypes | import("../ObjectEventType").Types | 'change:active' | 'translateend' | 'translatestart' | 'translating', Return>;
|
||||
import Event from "../events/Event.js";
|
||||
import Collection from "../Collection.js";
|
||||
type TranslateEventType = string;
|
||||
declare namespace TranslateEventType {
|
||||
const TRANSLATESTART: string;
|
||||
const TRANSLATING: string;
|
||||
const TRANSLATEEND: string;
|
||||
}
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'translateend'|'translatestart'|'translating', Return>} TranslateOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for translating (moving) features.
|
||||
* If you want to translate multiple features in a single action (for example,
|
||||
* the collection used by a select interaction), construct the interaction with
|
||||
* the `features` option.
|
||||
*
|
||||
* @fires TranslateEvent
|
||||
* @api
|
||||
*/
|
||||
declare class Translate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/***
|
||||
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
on: TranslateOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
once: TranslateOnSignature<import("../events").EventsKey>;
|
||||
/***
|
||||
* @type {TranslateOnSignature<void>}
|
||||
*/
|
||||
un: TranslateOnSignature<void>;
|
||||
/**
|
||||
* The last position we translated to.
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
private lastCoordinate_;
|
||||
/**
|
||||
* The start position before translation started.
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
private startCoordinate_;
|
||||
/**
|
||||
* @type {Collection<import("../Feature.js").default>|null}
|
||||
* @private
|
||||
*/
|
||||
private features_;
|
||||
/**
|
||||
* @private
|
||||
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
|
||||
*/
|
||||
private layerFilter_;
|
||||
/**
|
||||
* @private
|
||||
* @type {FilterFunction}
|
||||
*/
|
||||
private filter_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private hitTolerance_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
private condition_;
|
||||
/**
|
||||
* @type {import("../Feature.js").default}
|
||||
* @private
|
||||
*/
|
||||
private lastFeature_;
|
||||
/**
|
||||
* Tests to see if the given coordinates intersects any of our selected
|
||||
* features.
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
|
||||
* @param {import("../PluggableMap.js").default} map Map to test the intersection on.
|
||||
* @return {import("../Feature.js").default} Returns the feature found at the specified pixel
|
||||
* coordinates.
|
||||
* @private
|
||||
*/
|
||||
private featuresAtPixel_;
|
||||
/**
|
||||
* Returns the Hit-detection tolerance.
|
||||
* @return {number} Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
getHitTolerance(): number;
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
setHitTolerance(hitTolerance: number): void;
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
setMap(map: import("../PluggableMap.js").default): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleActiveChanged_;
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} oldMap Old map.
|
||||
* @private
|
||||
*/
|
||||
private updateState_;
|
||||
}
|
||||
import PointerInteraction from "./Pointer.js";
|
||||
//# sourceMappingURL=Translate.d.ts.map
|
||||
1
node_modules/ol/interaction/Translate.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Translate.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Translate.d.ts","sourceRoot":"","sources":["../src/interaction/Translate.js"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,kBANW,kBAAkB,YAClB,WAAW,OAAO,eAAe,EAAE,OAAO,CAAC,cAC3C,OAAO,kBAAkB,EAAE,UAAU,mBACrC,OAAO,kBAAkB,EAAE,UAAU,iEAmC/C;IA7BC;;;;OAIG;IACH,UAHU,WAAW,OAAO,eAAe,EAAE,OAAO,CAAC,CAG7B;IAExB;;;;;OAKG;IACH,YAHU,OAAO,kBAAkB,EAAE,UAAU,CAGnB;IAE5B;;;;;OAKG;IACH,iBAHU,OAAO,kBAAkB,EAAE,UAAU,CAGT;IAEtC;;;;OAIG;IACH,8DAAsC;CAEzC;;;;;;;;oCAtEqB,OAAO,eAAe,EAAE,WAAW,QAAE,OAAO,mBAAmB,EAAE,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,KAAE,OAAO;;;;;;;;;;;;;;;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8BAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,QAM9C;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,qBAUC;CACF"}
|
||||
369
node_modules/ol/interaction/Translate.js
generated
vendored
Normal file
369
node_modules/ol/interaction/Translate.js
generated
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
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/interaction/Translate
|
||||
*/
|
||||
import Collection from '../Collection.js';
|
||||
import Event from '../events/Event.js';
|
||||
import InteractionProperty from './Property.js';
|
||||
import PointerInteraction from './Pointer.js';
|
||||
import { TRUE } from '../functions.js';
|
||||
import { always } from '../events/condition.js';
|
||||
import { includes } from '../array.js';
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
var TranslateEventType = {
|
||||
/**
|
||||
* Triggered upon feature translation start.
|
||||
* @event TranslateEvent#translatestart
|
||||
* @api
|
||||
*/
|
||||
TRANSLATESTART: 'translatestart',
|
||||
/**
|
||||
* Triggered upon feature translation.
|
||||
* @event TranslateEvent#translating
|
||||
* @api
|
||||
*/
|
||||
TRANSLATING: 'translating',
|
||||
/**
|
||||
* Triggered upon feature translation end.
|
||||
* @event TranslateEvent#translateend
|
||||
* @api
|
||||
*/
|
||||
TRANSLATEEND: 'translateend',
|
||||
};
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} or
|
||||
* {@link module:ol/render/Feature~RenderFeature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise.
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that
|
||||
* takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
||||
* boolean to indicate whether that event should be handled.
|
||||
* Default is {@link module:ol/events/condition.always}.
|
||||
* @property {Collection<import("../Feature.js").default>} [features] Features contained in this collection will be able to be translated together.
|
||||
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers] A list of layers from which features should be
|
||||
* translated. Alternatively, a filter function can be provided. The
|
||||
* function will be called for each layer in the map and should return
|
||||
* `true` for layers that you want to be translatable. If the option is
|
||||
* absent, all visible layers will be considered translatable.
|
||||
* Not used if `features` is provided.
|
||||
* @property {FilterFunction} [filter] A function
|
||||
* that takes an {@link module:ol/Feature~Feature} and an
|
||||
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
||||
* translated or `false` otherwise. Not used if `features` is provided.
|
||||
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/interaction/Translate~Translate} instances
|
||||
* are instances of this type.
|
||||
*/
|
||||
var TranslateEvent = /** @class */ (function (_super) {
|
||||
__extends(TranslateEvent, _super);
|
||||
/**
|
||||
* @param {TranslateEventType} type Type.
|
||||
* @param {Collection<import("../Feature.js").default>} features The features translated.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
*/
|
||||
function TranslateEvent(type, features, coordinate, startCoordinate, mapBrowserEvent) {
|
||||
var _this = _super.call(this, type) || this;
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {Collection<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
_this.features = features;
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
_this.coordinate = coordinate;
|
||||
/**
|
||||
* The coordinate of the start position before translation started.
|
||||
* @const
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
_this.startCoordinate = startCoordinate;
|
||||
/**
|
||||
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
_this.mapBrowserEvent = mapBrowserEvent;
|
||||
return _this;
|
||||
}
|
||||
return TranslateEvent;
|
||||
}(Event));
|
||||
export { TranslateEvent };
|
||||
/***
|
||||
* @template Return
|
||||
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
||||
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
||||
* 'change:active', import("../Object").ObjectEvent, Return> &
|
||||
* import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent, Return> &
|
||||
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types|
|
||||
* 'change:active'|'translateend'|'translatestart'|'translating', Return>} TranslateOnSignature
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Interaction for translating (moving) features.
|
||||
* If you want to translate multiple features in a single action (for example,
|
||||
* the collection used by a select interaction), construct the interaction with
|
||||
* the `features` option.
|
||||
*
|
||||
* @fires TranslateEvent
|
||||
* @api
|
||||
*/
|
||||
var Translate = /** @class */ (function (_super) {
|
||||
__extends(Translate, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Translate(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options ? opt_options : {};
|
||||
_this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
|
||||
/***
|
||||
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.on;
|
||||
/***
|
||||
* @type {TranslateOnSignature<import("../events").EventsKey>}
|
||||
*/
|
||||
_this.once;
|
||||
/***
|
||||
* @type {TranslateOnSignature<void>}
|
||||
*/
|
||||
_this.un;
|
||||
/**
|
||||
* The last position we translated to.
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
_this.lastCoordinate_ = null;
|
||||
/**
|
||||
* The start position before translation started.
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
_this.startCoordinate_ = null;
|
||||
/**
|
||||
* @type {Collection<import("../Feature.js").default>|null}
|
||||
* @private
|
||||
*/
|
||||
_this.features_ = options.features !== undefined ? options.features : null;
|
||||
/** @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} */
|
||||
var layerFilter;
|
||||
if (options.layers && !_this.features_) {
|
||||
if (typeof options.layers === 'function') {
|
||||
layerFilter = options.layers;
|
||||
}
|
||||
else {
|
||||
var layers_1 = options.layers;
|
||||
layerFilter = function (layer) {
|
||||
return includes(layers_1, layer);
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
layerFilter = TRUE;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
|
||||
*/
|
||||
_this.layerFilter_ = layerFilter;
|
||||
/**
|
||||
* @private
|
||||
* @type {FilterFunction}
|
||||
*/
|
||||
_this.filter_ = options.filter && !_this.features_ ? options.filter : TRUE;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
_this.condition_ = options.condition ? options.condition : always;
|
||||
/**
|
||||
* @type {import("../Feature.js").default}
|
||||
* @private
|
||||
*/
|
||||
_this.lastFeature_ = null;
|
||||
_this.addChangeListener(InteractionProperty.ACTIVE, _this.handleActiveChanged_);
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Handle pointer down events.
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
Translate.prototype.handleDownEvent = function (event) {
|
||||
if (!event.originalEvent || !this.condition_(event)) {
|
||||
return false;
|
||||
}
|
||||
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
|
||||
if (!this.lastCoordinate_ && this.lastFeature_) {
|
||||
this.startCoordinate_ = event.coordinate;
|
||||
this.lastCoordinate_ = event.coordinate;
|
||||
this.handleMoveEvent(event);
|
||||
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||
this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATESTART, features, event.coordinate, this.startCoordinate_, event));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer up events.
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
* @return {boolean} If the event was consumed.
|
||||
*/
|
||||
Translate.prototype.handleUpEvent = function (event) {
|
||||
if (this.lastCoordinate_) {
|
||||
this.lastCoordinate_ = null;
|
||||
this.handleMoveEvent(event);
|
||||
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||
this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATEEND, features, event.coordinate, this.startCoordinate_, event));
|
||||
// cleanup
|
||||
this.startCoordinate_ = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Handle pointer drag events.
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
*/
|
||||
Translate.prototype.handleDragEvent = function (event) {
|
||||
if (this.lastCoordinate_) {
|
||||
var newCoordinate = event.coordinate;
|
||||
var deltaX_1 = newCoordinate[0] - this.lastCoordinate_[0];
|
||||
var deltaY_1 = newCoordinate[1] - this.lastCoordinate_[1];
|
||||
var features = this.features_ || new Collection([this.lastFeature_]);
|
||||
features.forEach(function (feature) {
|
||||
var geom = feature.getGeometry();
|
||||
geom.translate(deltaX_1, deltaY_1);
|
||||
feature.setGeometry(geom);
|
||||
});
|
||||
this.lastCoordinate_ = newCoordinate;
|
||||
this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATING, features, newCoordinate, this.startCoordinate_, event));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Handle pointer move events.
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
*/
|
||||
Translate.prototype.handleMoveEvent = function (event) {
|
||||
var elem = event.map.getViewport();
|
||||
// Change the cursor to grab/grabbing if hovering any of the features managed
|
||||
// by the interaction
|
||||
if (this.featuresAtPixel_(event.pixel, event.map)) {
|
||||
elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');
|
||||
elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');
|
||||
}
|
||||
else {
|
||||
elem.classList.remove('ol-grab', 'ol-grabbing');
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Tests to see if the given coordinates intersects any of our selected
|
||||
* features.
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
|
||||
* @param {import("../PluggableMap.js").default} map Map to test the intersection on.
|
||||
* @return {import("../Feature.js").default} Returns the feature found at the specified pixel
|
||||
* coordinates.
|
||||
* @private
|
||||
*/
|
||||
Translate.prototype.featuresAtPixel_ = function (pixel, map) {
|
||||
return map.forEachFeatureAtPixel(pixel, function (feature, layer) {
|
||||
if (this.filter_(feature, layer)) {
|
||||
if (!this.features_ || includes(this.features_.getArray(), feature)) {
|
||||
return feature;
|
||||
}
|
||||
}
|
||||
}.bind(this), {
|
||||
layerFilter: this.layerFilter_,
|
||||
hitTolerance: this.hitTolerance_,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Returns the Hit-detection tolerance.
|
||||
* @return {number} Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
Translate.prototype.getHitTolerance = function () {
|
||||
return this.hitTolerance_;
|
||||
};
|
||||
/**
|
||||
* Hit-detection tolerance. Pixels inside the radius around the given position
|
||||
* will be checked for features.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @api
|
||||
*/
|
||||
Translate.prototype.setHitTolerance = function (hitTolerance) {
|
||||
this.hitTolerance_ = hitTolerance;
|
||||
};
|
||||
/**
|
||||
* Remove the interaction from its current map and attach it to the new map.
|
||||
* Subclasses may set up event handlers to get notified about changes to
|
||||
* the map here.
|
||||
* @param {import("../PluggableMap.js").default} map Map.
|
||||
*/
|
||||
Translate.prototype.setMap = function (map) {
|
||||
var oldMap = this.getMap();
|
||||
_super.prototype.setMap.call(this, map);
|
||||
this.updateState_(oldMap);
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
Translate.prototype.handleActiveChanged_ = function () {
|
||||
this.updateState_(null);
|
||||
};
|
||||
/**
|
||||
* @param {import("../PluggableMap.js").default} oldMap Old map.
|
||||
* @private
|
||||
*/
|
||||
Translate.prototype.updateState_ = function (oldMap) {
|
||||
var map = this.getMap();
|
||||
var active = this.getActive();
|
||||
if (!map || !active) {
|
||||
map = map || oldMap;
|
||||
if (map) {
|
||||
var elem = map.getViewport();
|
||||
elem.classList.remove('ol-grab', 'ol-grabbing');
|
||||
}
|
||||
}
|
||||
};
|
||||
return Translate;
|
||||
}(PointerInteraction));
|
||||
export default Translate;
|
||||
//# sourceMappingURL=Translate.js.map
|
||||
1
node_modules/ol/interaction/Translate.js.map
generated
vendored
Normal file
1
node_modules/ol/interaction/Translate.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user