Shorter module paths for default exports

This commit is contained in:
ahocevar
2018-04-25 17:23:56 +02:00
parent 6cb115d6a4
commit 440d1ad3e1
233 changed files with 2136 additions and 2042 deletions

View File

@@ -18,7 +18,7 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
* Allows the user to zoom by double-clicking on the map.
*
* @constructor
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @param {module:ol/interaction/DoubleClickZoom~Options=} opt_options Options.
* @api
*/
@@ -48,11 +48,11 @@ inherits(DoubleClickZoom, Interaction);
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
* doubleclick) and eventually zooms the map.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/DoubleClickZoom~DoubleClickZoom}
* @this {module:ol/interaction/DoubleClickZoom}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -14,8 +14,8 @@ import {get as getProjection} from '../proj.js';
/**
* @typedef {Object} Options
* @property {Array.<function(new: module:ol/format/Feature~FeatureFormat)>} [formatConstructors] Format constructors.
* @property {module:ol/source/Vector~VectorSource} [source] Optional vector source where features will be added. If a source is provided
* @property {Array.<function(new: module:ol/format/Feature)>} [formatConstructors] Format constructors.
* @property {module:ol/source/Vector} [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
@@ -44,12 +44,12 @@ const DragAndDropEventType = {
* of this type.
*
* @constructor
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
* @implements {oli.interaction.DragAndDropEvent}
* @param {module:ol/interaction/DragAndDrop~DragAndDropEventType} type Type.
* @param {File} file File.
* @param {Array.<module:ol/Feature~Feature>=} opt_features Features.
* @param {module:ol/proj/Projection~Projection=} opt_projection Projection.
* @param {Array.<module:ol/Feature>=} opt_features Features.
* @param {module:ol/proj/Projection=} opt_projection Projection.
*/
const DragAndDropEvent = function(type, file, opt_features, opt_projection) {
@@ -57,7 +57,7 @@ const DragAndDropEvent = function(type, file, opt_features, opt_projection) {
/**
* The features parsed from dropped data.
* @type {Array.<module:ol/Feature~Feature>|undefined}
* @type {Array.<module:ol/Feature>|undefined}
* @api
*/
this.features = opt_features;
@@ -71,7 +71,7 @@ const DragAndDropEvent = function(type, file, opt_features, opt_projection) {
/**
* The feature projection.
* @type {module:ol/proj/Projection~Projection|undefined}
* @type {module:ol/proj/Projection|undefined}
* @api
*/
this.projection = opt_projection;
@@ -85,7 +85,7 @@ inherits(DragAndDropEvent, Event);
* Handles input of vector data by drag and drop.
*
* @constructor
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @fires module:ol/interaction/DragAndDrop~DragAndDropEvent
* @param {module:ol/interaction/DragAndDrop~Options=} opt_options Options.
* @api
@@ -100,14 +100,14 @@ const DragAndDrop = function(opt_options) {
/**
* @private
* @type {Array.<function(new: module:ol/format/Feature~FeatureFormat)>}
* @type {Array.<function(new: module:ol/format/Feature)>}
*/
this.formatConstructors_ = options.formatConstructors ?
options.formatConstructors : [];
/**
* @private
* @type {module:ol/proj/Projection~Projection}
* @type {module:ol/proj/Projection}
*/
this.projection_ = options.projection ?
getProjection(options.projection) : null;
@@ -120,7 +120,7 @@ const DragAndDrop = function(opt_options) {
/**
* @private
* @type {module:ol/source/Vector~VectorSource}
* @type {module:ol/source/Vector}
*/
this.source_ = options.source || null;
@@ -137,7 +137,7 @@ inherits(DragAndDrop, Interaction);
/**
* @param {Event} event Event.
* @this {module:ol/interaction/DragAndDrop~DragAndDrop}
* @this {module:ol/interaction/DragAndDrop}
*/
function handleDrop(event) {
const files = event.dataTransfer.files;
@@ -183,7 +183,7 @@ DragAndDrop.prototype.handleResult_ = function(file, event) {
*/
const formatConstructor = formatConstructors[i];
/**
* @type {module:ol/format/Feature~FeatureFormat}
* @type {module:ol/format/Feature}
*/
const format = new formatConstructor();
features = this.tryReadFeatures_(format, result, {
@@ -247,11 +247,11 @@ DragAndDrop.prototype.setMap = function(map) {
/**
* @param {module:ol/format/Feature~FeatureFormat} format Format.
* @param {module:ol/format/Feature} format Format.
* @param {string} text Text.
* @param {module:ol/format/Feature~ReadOptions} options Read options.
* @private
* @return {Array.<module:ol/Feature~Feature>} Features.
* @return {Array.<module:ol/Feature>} Features.
*/
DragAndDrop.prototype.tryReadFeatures_ = function(format, text, options) {
try {

View File

@@ -11,10 +11,10 @@ import RenderBox from '../render/Box.js';
/**
* A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
* A function that takes a {@link module:ol/MapBrowserEvent} and two
* {@link module:ol~Pixel}s and returns a `{boolean}`. If the condition is met,
* true should be returned.
* @typedef {function(module:ol/MapBrowserEvent~MapBrowserEvent, module:ol~Pixel, module:ol~Pixel):boolean} EndCondition
* @typedef {function(module:ol/MapBrowserEvent, module:ol~Pixel, module:ol~Pixel):boolean} EndCondition
*/
@@ -66,8 +66,8 @@ const DragBoxEventType = {
*
* @param {string} type The event type.
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Originating event.
* @extends {module:ol/events/Event~Event}
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Originating event.
* @extends {module:ol/events/Event}
* @constructor
* @implements {oli.DragBoxEvent}
*/
@@ -84,7 +84,7 @@ const DragBoxEvent = function(type, coordinate, mapBrowserEvent) {
/**
* @const
* @type {module:ol/MapBrowserEvent~MapBrowserEvent}
* @type {module:ol/MapBrowserEvent}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
@@ -106,7 +106,7 @@ inherits(DragBoxEvent, Event);
* This interaction is only supported for mouse devices.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @fires module:ol/interaction/DragBox~DragBoxEvent
* @param {module:ol/interaction/DragBox~Options=} opt_options Options.
* @api
@@ -159,12 +159,12 @@ inherits(DragBox, PointerInteraction);
/**
* The default condition for determining whether the boxend event
* should fire.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent
* @param {module:ol/MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent
* leading to the box end.
* @param {module:ol~Pixel} startPixel The starting pixel of the box.
* @param {module:ol~Pixel} endPixel The end pixel of the box.
* @return {boolean} Whether or not the boxend condition should be fired.
* @this {module:ol/interaction/DragBox~DragBox}
* @this {module:ol/interaction/DragBox}
*/
function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
const width = endPixel[0] - startPixel[0];
@@ -174,8 +174,8 @@ function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragBox~DragBox}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragBox}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -191,7 +191,7 @@ function handleDragEvent(mapBrowserEvent) {
/**
* Returns geometry of last drawn box.
* @return {module:ol/geom/Polygon~Polygon} Geometry.
* @return {module:ol/geom/Polygon} Geometry.
* @api
*/
DragBox.prototype.getGeometry = function() {
@@ -202,16 +202,16 @@ DragBox.prototype.getGeometry = function() {
/**
* To be overridden by child classes.
* FIXME: use constructor option instead of relying on overriding.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @protected
*/
DragBox.prototype.onBoxEnd = UNDEFINED;
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragBox~DragBox}
* @this {module:ol/interaction/DragBox}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -231,9 +231,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragBox~DragBox}
* @this {module:ol/interaction/DragBox}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -15,7 +15,7 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
* @property {module:ol/events/condition~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}.
* @property {module:ol/Kinetic~Kinetic} [kinetic] Kinetic inertia to apply to the pan.
* @property {module:ol/Kinetic} [kinetic] Kinetic inertia to apply to the pan.
*/
@@ -24,7 +24,7 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
* Allows the user to pan the map by dragging the map.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/DragPan~Options=} opt_options Options.
* @api
*/
@@ -40,7 +40,7 @@ const DragPan = function(opt_options) {
/**
* @private
* @type {module:ol/Kinetic~Kinetic|undefined}
* @type {module:ol/Kinetic|undefined}
*/
this.kinetic_ = options.kinetic;
@@ -72,8 +72,8 @@ inherits(DragPan, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragPan~DragPan}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragPan}
*/
function handleDragEvent(mapBrowserEvent) {
const targetPointers = this.targetPointers;
@@ -105,9 +105,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragPan~DragPan}
* @this {module:ol/interaction/DragPan}
*/
function handleUpEvent(mapBrowserEvent) {
const map = mapBrowserEvent.map;
@@ -143,9 +143,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragPan~DragPan}
* @this {module:ol/interaction/DragPan}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {

View File

@@ -29,7 +29,7 @@ import PointerInteraction from '../interaction/Pointer.js';
* This interaction is only supported for mouse devices.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/DragRotate~Options=} opt_options Options.
* @api
*/
@@ -66,8 +66,8 @@ inherits(DragRotate, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotate~DragRotate}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotate}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -93,9 +93,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragRotate~DragRotate}
* @this {module:ol/interaction/DragRotate}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -112,9 +112,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragRotate~DragRotate}
* @this {module:ol/interaction/DragRotate}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -30,7 +30,7 @@ import PointerInteraction from '../interaction/Pointer.js';
* And this interaction is not included in the default interactions.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/DragRotateAndZoom~Options=} opt_options Options.
* @api
*/
@@ -80,8 +80,8 @@ inherits(DragRotateAndZoom, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/DragRotateAndZoom}
*/
function handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -113,9 +113,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}
* @this {module:ol/interaction/DragRotateAndZoom}
*/
function handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {
@@ -134,9 +134,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/DragRotateAndZoom~DragRotateAndZoom}
* @this {module:ol/interaction/DragRotateAndZoom}
*/
function handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -31,7 +31,7 @@ import DragBox from '../interaction/DragBox.js';
* your custom one configured with `className`.
*
* @constructor
* @extends {module:ol/interaction/DragBox~DragBox}
* @extends {module:ol/interaction/DragBox}
* @param {module:ol/interaction/DragZoom~Options=} opt_options Options.
* @api
*/
@@ -68,7 +68,7 @@ inherits(DragZoom, DragBox);
DragZoom.prototype.onBoxEnd = function() {
const map = this.getMap();
const view = /** @type {!module:ol/View~View} */ (map.getView());
const view = /** @type {!module:ol/View} */ (map.getView());
const size = /** @type {!module:ol/size~Size} */ (map.getSize());

View File

@@ -38,7 +38,7 @@ import {createEditingStyle} from '../style/Style.js';
* 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.
* @property {module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features]
* @property {module:ol/Collection.<module:ol/Feature>} [features]
* Destination collection for the drawn features.
* @property {module:ol/source/Vector~Vector} [source] Destination source for
* the drawn features.
@@ -57,7 +57,7 @@ import {createEditingStyle} from '../style/Style.js';
* @property {module:ol/events/condition~Condition} [finishCondition] A function
* that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
* boolean to indicate whether the drawing can be finished.
* @property {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [style]
* @property {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style~StyleFunction} [style]
* Style for sketch features.
* @property {module:ol/interaction/Draw~GeometryFunction} [geometryFunction]
* Function that is called when a geometry's coordinates are updated.
@@ -87,8 +87,8 @@ import {createEditingStyle} from '../style/Style.js';
* arguments, and returns a geometry. The optional existing geometry is the
* geometry that is returned when the function is called without a second
* argument.
* @typedef {function(!Array.<module:ol/coordinate~Coordinate>, module:ol/geom/SimpleGeometry~SimpleGeometry=):
* module:ol/geom/SimpleGeometry~SimpleGeometry} GeometryFunction
* @typedef {function(!Array.<module:ol/coordinate~Coordinate>, module:ol/geom/SimpleGeometry=):
* module:ol/geom/SimpleGeometry} GeometryFunction
*/
@@ -130,10 +130,10 @@ const DrawEventType = {
* instances of this type.
*
* @constructor
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
* @implements {oli.DrawEvent}
* @param {module:ol/interaction/Draw~DrawEventType} type Type.
* @param {module:ol/Feature~Feature} feature The feature drawn.
* @param {module:ol/Feature} feature The feature drawn.
*/
const DrawEvent = function(type, feature) {
@@ -141,7 +141,7 @@ const DrawEvent = function(type, feature) {
/**
* The feature being drawn.
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @api
*/
this.feature = feature;
@@ -156,7 +156,7 @@ inherits(DrawEvent, Event);
* Interaction for drawing feature geometries.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @fires module:ol/interaction/Draw~DrawEvent
* @param {module:ol/interaction/Draw~Options} options Options.
* @api
@@ -208,7 +208,7 @@ const Draw = function(options) {
/**
* Target collection for drawn features.
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @private
*/
this.features_ = options.features ? options.features : null;
@@ -274,11 +274,11 @@ const Draw = function(options) {
/**
* @param {!Array.<module:ol/coordinate~Coordinate>} coordinates
* The coordinates.
* @param {module:ol/geom/SimpleGeometry~SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry~SimpleGeometry} A geometry.
* @param {module:ol/geom/SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry} A geometry.
*/
geometryFunction = function(coordinates, opt_geometry) {
const circle = opt_geometry ? /** @type {module:ol/geom/Circle~Circle} */ (opt_geometry) :
const circle = opt_geometry ? /** @type {module:ol/geom/Circle} */ (opt_geometry) :
new Circle([NaN, NaN]);
const squaredLength = squaredCoordinateDistance(
coordinates[0], coordinates[1]);
@@ -298,8 +298,8 @@ const Draw = function(options) {
/**
* @param {!Array.<module:ol/coordinate~Coordinate>} coordinates
* The coordinates.
* @param {module:ol/geom/SimpleGeometry~SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry~SimpleGeometry} A geometry.
* @param {module:ol/geom/SimpleGeometry=} opt_geometry Optional geometry.
* @return {module:ol/geom/SimpleGeometry} A geometry.
*/
geometryFunction = function(coordinates, opt_geometry) {
let geometry = opt_geometry;
@@ -344,14 +344,14 @@ const Draw = function(options) {
/**
* Sketch feature.
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.sketchFeature_ = null;
/**
* Sketch point.
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.sketchPoint_ = null;
@@ -365,7 +365,7 @@ const Draw = function(options) {
/**
* Sketch line. Used when drawing polygon.
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.sketchLine_ = null;
@@ -457,11 +457,11 @@ Draw.prototype.setMap = function(map) {
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may actually
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually
* draw or finish the drawing.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Map browser event.
* @param {module:ol/MapBrowserEvent} event Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Draw~Draw}
* @this {module:ol/interaction/Draw}
* @api
*/
export function handleEvent(event) {
@@ -511,9 +511,9 @@ export function handleEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} event Event.
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Draw~Draw}
* @this {module:ol/interaction/Draw}
*/
function handleDownEvent(event) {
this.shouldHandle_ = !this.freehand_;
@@ -539,9 +539,9 @@ function handleDownEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} event Event.
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Draw~Draw}
* @this {module:ol/interaction/Draw}
*/
function handleUpEvent(event) {
let pass = true;
@@ -584,7 +584,7 @@ function handleUpEvent(event) {
/**
* Handle move events.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event A move event.
* @param {module:ol/MapBrowserEvent} event A move event.
* @return {boolean} Pass the event to other interactions.
* @private
*/
@@ -616,7 +616,7 @@ Draw.prototype.handlePointerMove_ = function(event) {
/**
* Determine if an event is within the snapping tolerance of the start coord.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @param {module:ol/MapBrowserEvent} event Event.
* @return {boolean} The event is within the snapping tolerance of the start.
* @private
*/
@@ -655,7 +655,7 @@ Draw.prototype.atFinish_ = function(event) {
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @param {module:ol/MapBrowserEvent} event Event.
* @private
*/
Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
@@ -664,7 +664,7 @@ Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
this.sketchPoint_ = new Feature(new Point(coordinates));
this.updateSketchFeatures_();
} else {
const sketchPointGeom = /** @type {module:ol/geom/Point~Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = /** @type {module:ol/geom/Point} */ (this.sketchPoint_.getGeometry());
sketchPointGeom.setCoordinates(coordinates);
}
};
@@ -672,7 +672,7 @@ Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
/**
* Start the drawing.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @param {module:ol/MapBrowserEvent} event Event.
* @private
*/
Draw.prototype.startDrawing_ = function(event) {
@@ -703,12 +703,12 @@ Draw.prototype.startDrawing_ = function(event) {
/**
* Modify the drawing.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @param {module:ol/MapBrowserEvent} event Event.
* @private
*/
Draw.prototype.modifyDrawing_ = function(event) {
let coordinate = event.coordinate;
const geometry = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
let coordinates, last;
if (this.mode_ === Mode.POINT) {
last = this.sketchCoords_;
@@ -727,7 +727,7 @@ Draw.prototype.modifyDrawing_ = function(event) {
last[1] = coordinate[1];
this.geometryFunction_(/** @type {!Array.<module:ol/coordinate~Coordinate>} */ (this.sketchCoords_), geometry);
if (this.sketchPoint_) {
const sketchPointGeom = /** @type {module:ol/geom/Point~Point} */ (this.sketchPoint_.getGeometry());
const sketchPointGeom = /** @type {module:ol/geom/Point} */ (this.sketchPoint_.getGeometry());
sketchPointGeom.setCoordinates(coordinate);
}
let sketchLineGeom;
@@ -737,11 +737,11 @@ Draw.prototype.modifyDrawing_ = function(event) {
this.sketchLine_ = new Feature(new LineString(null));
}
const ring = geometry.getLinearRing(0);
sketchLineGeom = /** @type {module:ol/geom/LineString~LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom.setFlatCoordinates(
ring.getLayout(), ring.getFlatCoordinates());
} else if (this.sketchLineCoords_) {
sketchLineGeom = /** @type {module:ol/geom/LineString~LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom.setCoordinates(this.sketchLineCoords_);
}
this.updateSketchFeatures_();
@@ -750,12 +750,12 @@ Draw.prototype.modifyDrawing_ = function(event) {
/**
* Add a new coordinate to the drawing.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @param {module:ol/MapBrowserEvent} event Event.
* @private
*/
Draw.prototype.addToDrawing_ = function(event) {
const coordinate = event.coordinate;
const geometry = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
let done;
let coordinates;
if (this.mode_ === Mode.LINE_STRING) {
@@ -800,7 +800,7 @@ Draw.prototype.removeLastPoint = function() {
if (!this.sketchFeature_) {
return;
}
const geometry = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (this.sketchFeature_.getGeometry());
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (this.sketchFeature_.getGeometry());
let coordinates, sketchLineGeom;
if (this.mode_ === Mode.LINE_STRING) {
coordinates = this.sketchCoords_;
@@ -812,7 +812,7 @@ Draw.prototype.removeLastPoint = function() {
} else if (this.mode_ === Mode.POLYGON) {
coordinates = this.sketchCoords_[0];
coordinates.splice(-2, 1);
sketchLineGeom = /** @type {module:ol/geom/LineString~LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom = /** @type {module:ol/geom/LineString} */ (this.sketchLine_.getGeometry());
sketchLineGeom.setCoordinates(coordinates);
this.geometryFunction_(this.sketchCoords_, geometry);
}
@@ -837,7 +837,7 @@ Draw.prototype.finishDrawing = function() {
return;
}
let coordinates = this.sketchCoords_;
const geometry = /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ (sketchFeature.getGeometry());
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (sketchFeature.getGeometry());
if (this.mode_ === Mode.LINE_STRING) {
// remove the redundant last point
coordinates.pop();
@@ -873,7 +873,7 @@ Draw.prototype.finishDrawing = function() {
/**
* Stop drawing without adding the sketch feature to the target layer.
* @return {module:ol/Feature~Feature} The sketch feature (or null if none).
* @return {module:ol/Feature} The sketch feature (or null if none).
* @private
*/
Draw.prototype.abortDrawing_ = function() {
@@ -893,12 +893,12 @@ Draw.prototype.abortDrawing_ = function() {
* Extend an existing geometry by adding 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.
* @param {!module:ol/Feature~Feature} feature Feature to be extended.
* @param {!module:ol/Feature} feature Feature to be extended.
* @api
*/
Draw.prototype.extend = function(feature) {
const geometry = feature.getGeometry();
const lineString = /** @type {module:ol/geom/LineString~LineString} */ (geometry);
const lineString = /** @type {module:ol/geom/LineString} */ (geometry);
this.sketchFeature_ = feature;
this.sketchCoords_ = lineString.getCoordinates();
const last = this.sketchCoords_[this.sketchCoords_.length - 1];
@@ -963,20 +963,18 @@ Draw.prototype.updateState_ = function() {
* @api
*/
export function createRegularPolygon(opt_sides, opt_angle) {
return (
function(coordinates, opt_geometry) {
const center = coordinates[0];
const end = coordinates[1];
const radius = Math.sqrt(
squaredCoordinateDistance(center, end));
const geometry = opt_geometry ? /** @type {module:ol/geom/Polygon~Polygon} */ (opt_geometry) :
fromCircle(new Circle(center), opt_sides);
const angle = opt_angle ? opt_angle :
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
makeRegular(geometry, center, radius, angle);
return geometry;
}
);
return function(coordinates, opt_geometry) {
const center = coordinates[0];
const end = coordinates[1];
const radius = Math.sqrt(
squaredCoordinateDistance(center, end));
const geometry = opt_geometry ? /** @type {module:ol/geom/Polygon} */ (opt_geometry) :
fromCircle(new Circle(center), opt_sides);
const angle = opt_angle ? opt_angle :
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
makeRegular(geometry, center, radius, angle);
return geometry;
};
}
@@ -1025,7 +1023,9 @@ function getMode(type) {
} else if (type === GeometryType.CIRCLE) {
mode = Mode.CIRCLE;
}
return /** @type {!module:ol/interaction/Draw~Mode} */ (mode);
return (
/** @type {!module:ol/interaction/Draw~Mode} */ (mode)
);
}

View File

@@ -21,12 +21,12 @@ import {createEditingStyle} from '../style/Style.js';
* @typedef {Object} Options
* @property {module:ol/extent~Extent} [extent] Initial extent. Defaults to no
* initial extent.
* @property {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [boxStyle]
* @property {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style~StyleFunction} [boxStyle]
* Style for the drawn extent box. Defaults to
* {@link module:ol/style/Style~createEditing()['Polygon']}
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
* pointer close enough to a segment or vertex for editing.
* @property {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [pointerStyle]
* @property {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style~StyleFunction} [pointerStyle]
* Style for the cursor used to draw the extent. Defaults to
* {@link module:ol/style/Style~createEditing()['Point']}
* @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
@@ -55,7 +55,7 @@ const ExtentEventType = {
* @constructor
* @implements {oli.ExtentEvent}
* @param {module:ol/extent~Extent} extent the new extent
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
*/
const ExtentInteractionEvent = function(extent) {
Event.call(this, ExtentEventType.EXTENTCHANGED);
@@ -78,7 +78,7 @@ inherits(ExtentInteractionEvent, Event);
* This interaction is only supported for mouse devices.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @fires module:ol/interaction/Extent~Event
* @param {module:ol/interaction/Extent~Options=} opt_options Options.
* @api
@@ -118,14 +118,14 @@ const ExtentInteraction = function(opt_options) {
/**
* Feature for displaying the visible extent
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.extentFeature_ = null;
/**
* Feature for displaying the visible pointer
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.vertexFeature_ = null;
@@ -179,7 +179,7 @@ const ExtentInteraction = function(opt_options) {
inherits(ExtentInteraction, PointerInteraction);
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Event.
* @return {boolean} Propagate event?
* @this {module:ol/interaction/Extent~Extent}
*/
@@ -198,7 +198,7 @@ function handleEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Event handled?
* @this {module:ol/interaction/Extent~Extent}
*/
@@ -257,7 +257,7 @@ function handleDownEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Event handled?
* @this {module:ol/interaction/Extent~Extent}
*/
@@ -271,7 +271,7 @@ function handleDragEvent(mapBrowserEvent) {
}
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Extent~Extent}
*/
@@ -353,7 +353,7 @@ function getSegments(extent) {
/**
* @param {module:ol~Pixel} pixel cursor location
* @param {module:ol/PluggableMap~PluggableMap} map map
* @param {module:ol/PluggableMap} map map
* @returns {module:ol/coordinate~Coordinate|null} snapped vertex on extent
* @private
*/
@@ -394,7 +394,7 @@ ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) {
};
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent pointer move event
* @param {module:ol/MapBrowserEvent} mapBrowserEvent pointer move event
* @private
*/
ExtentInteraction.prototype.handlePointerMove_ = function(mapBrowserEvent) {
@@ -410,7 +410,7 @@ ExtentInteraction.prototype.handlePointerMove_ = function(mapBrowserEvent) {
/**
* @param {module:ol/extent~Extent} extent extent
* @returns {module:ol/Feature~Feature} extent as featrue
* @returns {module:ol/Feature} extent as featrue
* @private
*/
ExtentInteraction.prototype.createOrUpdateExtentFeature_ = function(extent) {
@@ -437,7 +437,7 @@ ExtentInteraction.prototype.createOrUpdateExtentFeature_ = function(extent) {
/**
* @param {module:ol/coordinate~Coordinate} vertex location of feature
* @returns {module:ol/Feature~Feature} vertex as feature
* @returns {module:ol/Feature} vertex as feature
* @private
*/
ExtentInteraction.prototype.createOrUpdatePointerFeature_ = function(vertex) {
@@ -447,7 +447,7 @@ ExtentInteraction.prototype.createOrUpdatePointerFeature_ = function(vertex) {
this.vertexFeature_ = vertexFeature;
this.vertexOverlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {module:ol/geom/Point~Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
geometry.setCoordinates(vertex);
}
return vertexFeature;

View File

@@ -11,7 +11,7 @@ import {clamp} from '../math.js';
/**
* Object literal with config options for interactions.
* @typedef {Object} InteractionOptions
* @property {function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean} handleEvent
* @property {function(module:ol/MapBrowserEvent):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
@@ -33,7 +33,7 @@ import {clamp} from '../math.js';
*
* @constructor
* @param {module:ol/interaction/Interaction~InteractionOptions} options Options.
* @extends {module:ol/Object~BaseObject}
* @extends {module:ol/Object}
* @api
*/
const Interaction = function(options) {
@@ -42,14 +42,14 @@ const Interaction = function(options) {
/**
* @private
* @type {module:ol/PluggableMap~PluggableMap}
* @type {module:ol/PluggableMap}
*/
this.map_ = null;
this.setActive(true);
/**
* @type {function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean}
* @type {function(module:ol/MapBrowserEvent):boolean}
*/
this.handleEvent = options.handleEvent;
@@ -71,7 +71,7 @@ Interaction.prototype.getActive = function() {
/**
* Get the map associated with this interaction.
* @return {module:ol/PluggableMap~PluggableMap} Map.
* @return {module:ol/PluggableMap} Map.
* @api
*/
Interaction.prototype.getMap = function() {
@@ -94,7 +94,7 @@ Interaction.prototype.setActive = function(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 {module:ol/PluggableMap~PluggableMap} map Map.
* @param {module:ol/PluggableMap} map Map.
*/
Interaction.prototype.setMap = function(map) {
this.map_ = map;
@@ -102,7 +102,7 @@ Interaction.prototype.setMap = function(map) {
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {module:ol/coordinate~Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
@@ -125,7 +125,7 @@ export function pan(view, delta, opt_duration) {
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {number|undefined} rotation Rotation.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
@@ -137,7 +137,7 @@ export function rotate(view, rotation, opt_anchor, opt_duration) {
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {number|undefined} rotation Rotation.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
@@ -161,7 +161,7 @@ export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duratio
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
@@ -181,7 +181,7 @@ export function zoom(view, resolution, opt_anchor, opt_duration, opt_direction)
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {number} delta Delta from previous zoom level.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
@@ -219,7 +219,7 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
/**
* @param {module:ol/View~View} view View.
* @param {module:ol/View} view View.
* @param {number|undefined} resolution Resolution to go to.
* @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.

View File

@@ -35,7 +35,7 @@ import Interaction, {pan} from '../interaction/Interaction.js';
* See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.
*
* @constructor
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @param {module:ol/interaction/KeyboardPan~Options=} opt_options Options.
* @api
*/
@@ -49,7 +49,7 @@ const KeyboardPan = function(opt_options) {
/**
* @private
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
* @return {boolean} Combined condition result.
*/
this.defaultCondition_ = function(mapBrowserEvent) {
@@ -82,12 +82,12 @@ const KeyboardPan = function(opt_options) {
inherits(KeyboardPan, Interaction);
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
* Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a
* `KeyEvent`, and decides the direction to pan to (if an arrow key was
* pressed).
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/KeyboardPan~KeyboardPan}
* @this {module:ol/interaction/KeyboardPan}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -32,7 +32,7 @@ import Interaction, {zoomByDelta} from '../interaction/Interaction.js';
*
* @constructor
* @param {module:ol/interaction/KeyboardZoom~Options=} opt_options Options.
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @api
*/
const KeyboardZoom = function(opt_options) {
@@ -67,12 +67,12 @@ inherits(KeyboardZoom, Interaction);
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} if it was a
* Handles the {@link module:ol/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 {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/KeyboardZoom~KeyboardZoom}
* @this {module:ol/interaction/KeyboardZoom}
*/
function handleEvent(mapBrowserEvent) {
let stopEvent = false;

View File

@@ -46,8 +46,8 @@ const ModifyEventType = {
/**
* @typedef {Object} SegmentData
* @property {Array.<number>} [depth]
* @property {module:ol/Feature~Feature} feature
* @property {module:ol/geom/SimpleGeometry~SimpleGeometry} geometry
* @property {module:ol/Feature} feature
* @property {module:ol/geom/SimpleGeometry} geometry
* @property {number} index
* @property {Array.<module:ol/extent~Extent>} segment
* @property {Array.<module:ol/interaction/Modify~SegmentData>} [featureSegments]
@@ -72,13 +72,13 @@ const ModifyEventType = {
* 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 {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [style]
* @property {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style~StyleFunction} [style]
* Style used for the features being modified. By default the default edit
* style is used (see {@link module:ol/style}).
* @property {module:ol/source/Vector~Vector} [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 {module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features]
* @property {module:ol/Collection.<module:ol/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
@@ -92,13 +92,13 @@ const ModifyEventType = {
* instances of this type.
*
* @constructor
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
* @implements {oli.ModifyEvent}
* @param {ModifyEventType} type Type.
* @param {module:ol/Collection~Collection.<module:ol/Feature~Feature>} features
* @param {module:ol/Collection.<module:ol/Feature>} features
* The features modified.
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserPointerEvent
* Associated {@link module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent}.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserPointerEvent
* Associated {@link module:ol/MapBrowserPointerEvent}.
*/
export const ModifyEvent = function(type, features, mapBrowserPointerEvent) {
@@ -106,14 +106,14 @@ export const ModifyEvent = function(type, features, mapBrowserPointerEvent) {
/**
* The features being modified.
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @api
*/
this.features = features;
/**
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent~MapBrowserEvent}
* Associated {@link module:ol/MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent}
* @api
*/
this.mapBrowserEvent = mapBrowserPointerEvent;
@@ -136,7 +136,7 @@ inherits(ModifyEvent, Event);
* for deletion, use the `deleteCondition` option.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/Modify~Options} options Options.
* @fires module:ol/interaction/Modify~ModifyEvent
* @api
@@ -159,7 +159,7 @@ const Modify = function(options) {
/**
* @private
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Browser event.
* @return {boolean} Combined condition result.
*/
this.defaultDeleteCondition_ = function(mapBrowserEvent) {
@@ -182,7 +182,7 @@ const Modify = function(options) {
/**
* Editing vertex.
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.vertexFeature_ = null;
@@ -216,7 +216,7 @@ const Modify = function(options) {
/**
* Segment RTree for each layer
* @type {module:ol/structs/RBush~RBush.<module:ol/interaction/Modify~SegmentData>}
* @type {module:ol/structs/RBush.<module:ol/interaction/Modify~SegmentData>}
* @private
*/
this.rBush_ = new RBush();
@@ -265,10 +265,10 @@ const Modify = function(options) {
});
/**
* @const
* @private
* @type {!Object.<string, function(module:ol/Feature~Feature, module:ol/geom/Geometry~Geometry)>}
*/
* @const
* @private
* @type {!Object.<string, function(module:ol/Feature, module:ol/geom/Geometry)>}
*/
this.SEGMENT_WRITERS_ = {
'Point': this.writePointGeometry_,
'LineString': this.writeLineStringGeometry_,
@@ -304,7 +304,7 @@ const Modify = function(options) {
}
/**
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @private
*/
this.features_ = features;
@@ -316,7 +316,7 @@ const Modify = function(options) {
this.handleFeatureRemove_, this);
/**
* @type {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent}
* @type {module:ol/MapBrowserPointerEvent}
* @private
*/
this.lastPointerEvent_ = null;
@@ -342,7 +342,7 @@ const CIRCLE_CIRCUMFERENCE_INDEX = 1;
/**
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @private
*/
Modify.prototype.addFeature_ = function(feature) {
@@ -360,7 +360,7 @@ Modify.prototype.addFeature_ = function(feature) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} evt Map browser event
* @param {module:ol/MapBrowserPointerEvent} evt Map browser event
* @private
*/
Modify.prototype.willModifyFeatures_ = function(evt) {
@@ -373,7 +373,7 @@ Modify.prototype.willModifyFeatures_ = function(evt) {
/**
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @private
*/
Modify.prototype.removeFeature_ = function(feature) {
@@ -390,7 +390,7 @@ Modify.prototype.removeFeature_ = function(feature) {
/**
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @private
*/
Modify.prototype.removeFeatureSegmentData_ = function(feature) {
@@ -459,17 +459,17 @@ Modify.prototype.handleSourceRemove_ = function(event) {
* @private
*/
Modify.prototype.handleFeatureAdd_ = function(evt) {
this.addFeature_(/** @type {module:ol/Feature~Feature} */ (evt.element));
this.addFeature_(/** @type {module:ol/Feature} */ (evt.element));
};
/**
* @param {module:ol/events/Event~Event} evt Event.
* @param {module:ol/events/Event} evt Event.
* @private
*/
Modify.prototype.handleFeatureChange_ = function(evt) {
if (!this.changingFeature_) {
const feature = /** @type {module:ol/Feature~Feature} */ (evt.target);
const feature = /** @type {module:ol/Feature} */ (evt.target);
this.removeFeature_(feature);
this.addFeature_(feature);
}
@@ -481,14 +481,14 @@ Modify.prototype.handleFeatureChange_ = function(evt) {
* @private
*/
Modify.prototype.handleFeatureRemove_ = function(evt) {
const feature = /** @type {module:ol/Feature~Feature} */ (evt.element);
const feature = /** @type {module:ol/Feature} */ (evt.element);
this.removeFeature_(feature);
};
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/Point~Point} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Point} geometry Geometry.
* @private
*/
Modify.prototype.writePointGeometry_ = function(feature, geometry) {
@@ -503,8 +503,8 @@ Modify.prototype.writePointGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiPoint~MultiPoint} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPoint} geometry Geometry.
* @private
*/
Modify.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
@@ -524,8 +524,8 @@ Modify.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/LineString~LineString} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/LineString} geometry Geometry.
* @private
*/
Modify.prototype.writeLineStringGeometry_ = function(feature, geometry) {
@@ -544,8 +544,8 @@ Modify.prototype.writeLineStringGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiLineString~MultiLineString} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiLineString} geometry Geometry.
* @private
*/
Modify.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
@@ -568,8 +568,8 @@ Modify.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/Polygon~Polygon} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Polygon} geometry Geometry.
* @private
*/
Modify.prototype.writePolygonGeometry_ = function(feature, geometry) {
@@ -592,8 +592,8 @@ Modify.prototype.writePolygonGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiPolygon~MultiPolygon} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPolygon} geometry Geometry.
* @private
*/
Modify.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
@@ -625,8 +625,8 @@ Modify.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
* {@link CIRCLE_CIRCUMFERENCE_INDEX} is
* the circumference, and is not a line segment.
*
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/geom/Circle~Circle} geometry Geometry.
* @param {module:ol/Feature} feature Feature.
* @param {module:ol/geom/Circle} geometry Geometry.
* @private
*/
Modify.prototype.writeCircleGeometry_ = function(feature, geometry) {
@@ -651,8 +651,8 @@ Modify.prototype.writeCircleGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/GeometryCollection~GeometryCollection} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/GeometryCollection} geometry Geometry.
* @private
*/
Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) {
@@ -665,7 +665,7 @@ Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry)
/**
* @param {module:ol/coordinate~Coordinate} coordinates Coordinates.
* @return {module:ol/Feature~Feature} Vertex feature.
* @return {module:ol/Feature} Vertex feature.
* @private
*/
Modify.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
@@ -675,7 +675,7 @@ Modify.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
this.vertexFeature_ = vertexFeature;
this.overlay_.getSource().addFeature(vertexFeature);
} else {
const geometry = /** @type {module:ol/geom/Point~Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
geometry.setCoordinates(coordinates);
}
return vertexFeature;
@@ -693,9 +693,9 @@ function compareIndexes(a, b) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} evt Event.
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Modify~Modify}
* @this {module:ol/interaction/Modify}
*/
function handleDownEvent(evt) {
if (!this.condition_(evt)) {
@@ -708,7 +708,7 @@ function handleDownEvent(evt) {
const vertexFeature = this.vertexFeature_;
if (vertexFeature) {
const insertVertices = [];
const geometry = /** @type {module:ol/geom/Point~Point} */ (vertexFeature.getGeometry());
const geometry = /** @type {module:ol/geom/Point} */ (vertexFeature.getGeometry());
const vertex = geometry.getCoordinates();
const vertexExtent = boundingExtent([vertex]);
const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
@@ -769,8 +769,8 @@ function handleDownEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} evt Event.
* @this {module:ol/interaction/Modify~Modify}
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @this {module:ol/interaction/Modify}
*/
function handleDragEvent(evt) {
this.ignoreNextSingleClick_ = false;
@@ -845,9 +845,9 @@ function handleDragEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} evt Event.
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Modify~Modify}
* @this {module:ol/interaction/Modify}
*/
function handleUpEvent(evt) {
for (let i = this.dragSegments_.length - 1; i >= 0; --i) {
@@ -875,11 +875,11 @@ function handleUpEvent(evt) {
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the
* geometry.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Modify~Modify}
* @this {module:ol/interaction/Modify}
*/
function handleEvent(mapBrowserEvent) {
if (!(mapBrowserEvent instanceof MapBrowserPointerEvent)) {
@@ -910,7 +910,7 @@ function handleEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Event.
* @param {module:ol/MapBrowserEvent} evt Event.
* @private
*/
Modify.prototype.handlePointerMove_ = function(evt) {
@@ -921,7 +921,7 @@ Modify.prototype.handlePointerMove_ = function(evt) {
/**
* @param {module:ol~Pixel} pixel Pixel
* @param {module:ol/PluggableMap~PluggableMap} map Map.
* @param {module:ol/PluggableMap} map Map.
* @private
*/
Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
@@ -1000,7 +1000,7 @@ function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) {
const geometry = segmentData.geometry;
if (geometry.getType() === GeometryType.CIRCLE) {
const circleGeometry = /** @type {module:ol/geom/Circle~Circle} */ (geometry);
const circleGeometry = /** @type {module:ol/geom/Circle} */ (geometry);
if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {
const distanceToCenterSquared =
@@ -1235,7 +1235,7 @@ Modify.prototype.removeVertex_ = function() {
/**
* @param {module:ol/geom/SimpleGeometry~SimpleGeometry} geometry Geometry.
* @param {module:ol/geom/SimpleGeometry} geometry Geometry.
* @param {Array} coordinates Coordinates.
* @private
*/
@@ -1247,7 +1247,7 @@ Modify.prototype.setGeometryCoordinates_ = function(geometry, coordinates) {
/**
* @param {module:ol/geom/SimpleGeometry~SimpleGeometry} geometry Geometry.
* @param {module:ol/geom/SimpleGeometry} geometry Geometry.
* @param {number} index Index.
* @param {Array.<number>|undefined} depth Depth.
* @param {number} delta Delta (1 or -1).

View File

@@ -49,7 +49,7 @@ export const Mode = {
* Allows the user to zoom the map by scrolling the mouse wheel.
*
* @constructor
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @param {module:ol/interaction/MouseWheelZoom~Options=} opt_options Options.
* @api
*/
@@ -153,11 +153,11 @@ inherits(MouseWheelZoom, Interaction);
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} (if it was a
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
* mousewheel-event) and eventually zooms the map.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} Allow event propagation.
* @this {module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
* @this {module:ol/interaction/MouseWheelZoom}
*/
function handleEvent(mapBrowserEvent) {
if (!this.condition_(mapBrowserEvent)) {
@@ -288,7 +288,7 @@ MouseWheelZoom.prototype.decrementInteractingHint_ = function() {
/**
* @private
* @param {module:ol/PluggableMap~PluggableMap} map Map.
* @param {module:ol/PluggableMap} map Map.
*/
MouseWheelZoom.prototype.handleWheelZoom_ = function(map) {
const view = map.getView();

View File

@@ -23,7 +23,7 @@ import {disable} from '../rotationconstraint.js';
* on a touch screen.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/PinchRotate~Options=} opt_options Options.
* @api
*/
@@ -79,8 +79,8 @@ inherits(PinchRotate, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchRotate~PinchRotate}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchRotate}
*/
function handleDragEvent(mapBrowserEvent) {
let rotationDelta = 0.0;
@@ -129,9 +129,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/PinchRotate~PinchRotate}
* @this {module:ol/interaction/PinchRotate}
*/
function handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) {
@@ -150,9 +150,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/PinchRotate~PinchRotate}
* @this {module:ol/interaction/PinchRotate}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) {

View File

@@ -22,7 +22,7 @@ import PointerInteraction, {centroid as centroidFromPointers} from '../interacti
* on a touch screen.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/PinchZoom~Options=} opt_options Options.
* @api
*/
@@ -72,8 +72,8 @@ inherits(PinchZoom, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchZoom~PinchZoom}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/PinchZoom}
*/
function handleDragEvent(mapBrowserEvent) {
let scaleDelta = 1.0;
@@ -124,9 +124,9 @@ function handleDragEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/PinchZoom~PinchZoom}
* @this {module:ol/interaction/PinchZoom}
*/
function handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) {
@@ -151,9 +151,9 @@ function handleUpEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/PinchZoom~PinchZoom}
* @this {module:ol/interaction/PinchZoom}
*/
function handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) {

View File

@@ -10,53 +10,53 @@ import {getValues} from '../obj.js';
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer~PointerInteraction}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer}
*/
const handleDragEvent = UNDEFINED;
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Capture dragging.
* @this {module:ol/interaction/Pointer~PointerInteraction}
* @this {module:ol/interaction/Pointer}
*/
const handleUpEvent = FALSE;
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Capture dragging.
* @this {module:ol/interaction/Pointer~PointerInteraction}
* @this {module:ol/interaction/Pointer}
*/
const handleDownEvent = FALSE;
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer~PointerInteraction}
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {module:ol/interaction/Pointer}
*/
const handleMoveEvent = UNDEFINED;
/**
* @typedef {Object} Options
* @property {(function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean)} [handleDownEvent]
* @property {(function(module:ol/MapBrowserPointerEvent):boolean)} [handleDownEvent]
* Function handling "down" events. If the function returns `true` then a drag
* sequence is started.
* @property {(function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent))} [handleDragEvent]
* @property {(function(module:ol/MapBrowserPointerEvent))} [handleDragEvent]
* Function handling "drag" events. This function is called on "move" events
* during a drag sequence.
* @property {(function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean)} [handleEvent]
* @property {(function(module:ol/MapBrowserEvent):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(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent))} [handleMoveEvent]
* @property {(function(module:ol/MapBrowserPointerEvent))} [handleMoveEvent]
* Function handling "move" events. This function is called on "move" events,
* also during a drag sequence (so during a drag sequence both the
* `handleDragEvent` function and this function are called).
* @property {(function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean)} [handleUpEvent]
* @property {(function(module:ol/MapBrowserPointerEvent):boolean)} [handleUpEvent]
* Function handling "up" events. If the function returns `false` then the
* current drag sequence is stopped.
*/
@@ -74,7 +74,7 @@ const handleMoveEvent = UNDEFINED;
*
* @constructor
* @param {module:ol/interaction/Pointer~Options=} opt_options Options.
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @api
*/
const PointerInteraction = function(opt_options) {
@@ -86,28 +86,28 @@ const PointerInteraction = function(opt_options) {
});
/**
* @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean}
* @type {function(module:ol/MapBrowserPointerEvent):boolean}
* @private
*/
this.handleDownEvent_ = options.handleDownEvent ?
options.handleDownEvent : handleDownEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)}
* @type {function(module:ol/MapBrowserPointerEvent)}
* @private
*/
this.handleDragEvent_ = options.handleDragEvent ?
options.handleDragEvent : handleDragEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)}
* @type {function(module:ol/MapBrowserPointerEvent)}
* @private
*/
this.handleMoveEvent_ = options.handleMoveEvent ?
options.handleMoveEvent : handleMoveEvent;
/**
* @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean}
* @type {function(module:ol/MapBrowserPointerEvent):boolean}
* @private
*/
this.handleUpEvent_ = options.handleUpEvent ?
@@ -120,13 +120,13 @@ const PointerInteraction = function(opt_options) {
this.handlingDownUpSequence = false;
/**
* @type {!Object.<string, module:ol/pointer/PointerEvent~PointerEvent>}
* @type {!Object.<string, module:ol/pointer/PointerEvent>}
* @private
*/
this.trackedPointers_ = {};
/**
* @type {Array.<module:ol/pointer/PointerEvent~PointerEvent>}
* @type {Array.<module:ol/pointer/PointerEvent>}
* @protected
*/
this.targetPointers = [];
@@ -137,7 +137,7 @@ inherits(PointerInteraction, Interaction);
/**
* @param {Array.<module:ol/pointer/PointerEvent~PointerEvent>} pointerEvents List of events.
* @param {Array.<module:ol/pointer/PointerEvent>} pointerEvents List of events.
* @return {module:ol~Pixel} Centroid pixel.
*/
export function centroid(pointerEvents) {
@@ -153,7 +153,7 @@ export function centroid(pointerEvents) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Whether the event is a pointerdown, pointerdrag
* or pointerup event.
*/
@@ -166,7 +166,7 @@ function isPointerDraggingEvent(mapBrowserEvent) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
* @private
*/
PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) {
@@ -189,12 +189,12 @@ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent)
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may call into
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
* other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
* detected.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Pointer~PointerInteraction}
* @this {module:ol/interaction/Pointer}
* @api
*/
export function handleEvent(mapBrowserEvent) {

View File

@@ -30,11 +30,11 @@ const SelectEventType = {
/**
* A function that takes an {@link module:ol/Feature~Feature} or
* A function that takes an {@link module:ol/Feature} or
* {@link module:ol/render/Feature~Feature} and an
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* selected or `false` otherwise.
* @typedef {function((module:ol/Feature~Feature|module:ol/render/Feature~Feature), module:ol/layer/Layer~Layer):
* @typedef {function((module:ol/Feature|module:ol/render/Feature~Feature), module:ol/layer/Layer):
* boolean} FilterFunction
*/
@@ -55,13 +55,13 @@ const SelectEventType = {
* feature removes all from the selection.
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
* from the selection.
* @property {Array.<module:ol/layer/Layer~Layer>|function(module:ol/layer/Layer~Layer): boolean} [layers]
* @property {Array.<module:ol/layer/Layer>|function(module:ol/layer/Layer): 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 {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [style]
* @property {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style~StyleFunction} [style]
* Style for the selected features. By default the default edit style is used
* (see {@link module:ol/style}).
* @property {module:ol/events/condition~Condition} [removeCondition] A function
@@ -80,14 +80,14 @@ const SelectEventType = {
* @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 {module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features]
* @property {module:ol/Collection.<module:ol/Feature>} [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 {module:ol/interaction/Select~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
* that takes an {@link module:ol/Feature} and an
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* selected or `false` otherwise.
* @property {boolean} [wrapX=true] Wrap the world horizontally on the selection
* overlay.
@@ -103,12 +103,12 @@ const SelectEventType = {
* this type.
*
* @param {SelectEventType} type The event type.
* @param {Array.<module:ol/Feature~Feature>} selected Selected features.
* @param {Array.<module:ol/Feature~Feature>} deselected Deselected features.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Associated
* {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
* @param {Array.<module:ol/Feature>} selected Selected features.
* @param {Array.<module:ol/Feature>} deselected Deselected features.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Associated
* {@link module:ol/MapBrowserEvent}.
* @implements {oli.SelectEvent}
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
* @constructor
*/
const SelectEvent = function(type, selected, deselected, mapBrowserEvent) {
@@ -116,21 +116,21 @@ const SelectEvent = function(type, selected, deselected, mapBrowserEvent) {
/**
* Selected features array.
* @type {Array.<module:ol/Feature~Feature>}
* @type {Array.<module:ol/Feature>}
* @api
*/
this.selected = selected;
/**
* Deselected features array.
* @type {Array.<module:ol/Feature~Feature>}
* @type {Array.<module:ol/Feature>}
* @api
*/
this.deselected = deselected;
/**
* Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent~MapBrowserEvent}
* Associated {@link module:ol/MapBrowserEvent}.
* @type {module:ol/MapBrowserEvent}
* @api
*/
this.mapBrowserEvent = mapBrowserEvent;
@@ -152,7 +152,7 @@ inherits(SelectEvent, Event);
* Selected features are added to an internal unmanaged layer.
*
* @constructor
* @extends {module:ol/interaction/Interaction~Interaction}
* @extends {module:ol/interaction/Interaction}
* @param {module:ol/interaction/Select~Options=} opt_options Options.
* @fires SelectEvent
* @api
@@ -225,7 +225,7 @@ const Select = function(opt_options) {
*/
this.featureOverlay_ = featureOverlay;
/** @type {function(module:ol/layer/Layer~Layer): boolean} */
/** @type {function(module:ol/layer/Layer): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -242,7 +242,7 @@ const Select = function(opt_options) {
/**
* @private
* @type {function(module:ol/layer/Layer~Layer): boolean}
* @type {function(module:ol/layer/Layer): boolean}
*/
this.layerFilter_ = layerFilter;
@@ -250,7 +250,7 @@ const Select = function(opt_options) {
* An association between selected feature (key)
* and layer (value)
* @private
* @type {Object.<number, module:ol/layer/Layer~Layer>}
* @type {Object.<number, module:ol/layer/Layer>}
*/
this.featureLayerAssociation_ = {};
@@ -266,8 +266,8 @@ inherits(Select, Interaction);
/**
* @param {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer~Layer} layer Layer.
* @param {module:ol/Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @private
*/
Select.prototype.addFeatureLayerAssociation_ = function(feature, layer) {
@@ -278,7 +278,7 @@ Select.prototype.addFeatureLayerAssociation_ = function(feature, layer) {
/**
* Get the selected features.
* @return {module:ol/Collection~Collection.<module:ol/Feature~Feature>} Features collection.
* @return {module:ol/Collection.<module:ol/Feature>} Features collection.
* @api
*/
Select.prototype.getFeatures = function() {
@@ -301,22 +301,24 @@ Select.prototype.getHitTolerance = function() {
* the (last) selected feature. Note that this will not work with any
* programmatic method like pushing features to
* {@link module:ol/interaction/Select~Select#getFeatures collection}.
* @param {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature Feature
* @param {module:ol/Feature|module:ol/render/Feature~Feature} feature Feature
* @return {module:ol/layer/Vector~Vector} Layer.
* @api
*/
Select.prototype.getLayer = function(feature) {
const key = getUid(feature);
return /** @type {module:ol/layer/Vector~Vector} */ (this.featureLayerAssociation_[key]);
return (
/** @type {module:ol/layer/Vector~Vector} */ (this.featureLayerAssociation_[key])
);
};
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may change the
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may change the
* selected state of features.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @this {module:ol/interaction/Select~Select}
* @this {module:ol/interaction/Select}
*/
function handleEvent(mapBrowserEvent) {
if (!this.condition_(mapBrowserEvent)) {
@@ -338,8 +340,8 @@ function handleEvent(mapBrowserEvent) {
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(
/**
* @param {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer~Layer} layer Layer.
* @param {module:ol/Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features.
*/
function(feature, layer) {
@@ -371,8 +373,8 @@ function handleEvent(mapBrowserEvent) {
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(
/**
* @param {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer~Layer} layer Layer.
* @param {module:ol/Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/layer/Layer} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features.
*/
function(feature, layer) {
@@ -419,7 +421,7 @@ Select.prototype.setHitTolerance = function(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 {module:ol/PluggableMap~PluggableMap} map Map.
* @param {module:ol/PluggableMap} map Map.
* @override
* @api
*/
@@ -462,7 +464,7 @@ function getDefaultStyleFunction() {
Select.prototype.addFeature_ = function(evt) {
const map = this.getMap();
if (map) {
map.skipFeature(/** @type {module:ol/Feature~Feature} */ (evt.element));
map.skipFeature(/** @type {module:ol/Feature} */ (evt.element));
}
};
@@ -474,13 +476,13 @@ Select.prototype.addFeature_ = function(evt) {
Select.prototype.removeFeature_ = function(evt) {
const map = this.getMap();
if (map) {
map.unskipFeature(/** @type {module:ol/Feature~Feature} */ (evt.element));
map.unskipFeature(/** @type {module:ol/Feature} */ (evt.element));
}
};
/**
* @param {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature Feature.
* @param {module:ol/Feature|module:ol/render/Feature~Feature} feature Feature.
* @private
*/
Select.prototype.removeFeatureLayerAssociation_ = function(feature) {

View File

@@ -28,14 +28,14 @@ import RBush from '../structs/RBush.js';
/**
* @typedef {Object} SegmentData
* @property {module:ol/Feature~Feature} feature
* @property {module:ol/Feature} feature
* @property {Array.<module:ol/coordinate~Coordinate>} segment
*/
/**
* @typedef {Object} Options
* @property {module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features] Snap to these features. Either this option or source should be provided.
* @property {module:ol/Collection.<module:ol/Feature>} [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
@@ -64,7 +64,7 @@ import RBush from '../structs/RBush.js';
* });
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @param {module:ol/interaction/Snap~Options=} opt_options Options.
* @api
*/
@@ -97,7 +97,7 @@ const Snap = function(opt_options) {
this.edge_ = options.edge !== undefined ? options.edge : true;
/**
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @private
*/
this.features_ = options.features ? options.features : null;
@@ -126,7 +126,7 @@ const Snap = function(opt_options) {
* 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.<number, module:ol/Feature~Feature>}
* @type {!Object.<number, module:ol/Feature>}
* @private
*/
this.pendingFeatures_ = {};
@@ -154,7 +154,7 @@ const Snap = function(opt_options) {
/**
* Segment RTree for each layer
* @type {module:ol/structs/RBush~RBush.<module:ol/interaction/Snap~SegmentData>}
* @type {module:ol/structs/RBush.<module:ol/interaction/Snap~SegmentData>}
* @private
*/
this.rBush_ = new RBush();
@@ -163,7 +163,7 @@ const Snap = function(opt_options) {
/**
* @const
* @private
* @type {Object.<string, function(module:ol/Feature~Feature, module:ol/geom/Geometry~Geometry)>}
* @type {Object.<string, function(module:ol/Feature, module:ol/geom/Geometry)>}
*/
this.SEGMENT_WRITERS_ = {
'Point': this.writePointGeometry_,
@@ -183,7 +183,7 @@ inherits(Snap, PointerInteraction);
/**
* Add a feature to the collection of features that we may snap to.
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @param {boolean=} opt_listen Whether to listen to the feature change or not
* Defaults to `true`.
* @api
@@ -210,7 +210,7 @@ Snap.prototype.addFeature = function(feature, opt_listen) {
/**
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @private
*/
Snap.prototype.forEachFeatureAdd_ = function(feature) {
@@ -219,7 +219,7 @@ Snap.prototype.forEachFeatureAdd_ = function(feature) {
/**
* @param {module:ol/Feature~Feature} feature Feature.
* @param {module:ol/Feature} feature Feature.
* @private
*/
Snap.prototype.forEachFeatureRemove_ = function(feature) {
@@ -228,7 +228,7 @@ Snap.prototype.forEachFeatureRemove_ = function(feature) {
/**
* @return {module:ol/Collection~Collection.<module:ol/Feature~Feature>|Array.<module:ol/Feature~Feature>} Features.
* @return {module:ol/Collection.<module:ol/Feature>|Array.<module:ol/Feature>} Features.
* @private
*/
Snap.prototype.getFeatures_ = function() {
@@ -238,12 +238,14 @@ Snap.prototype.getFeatures_ = function() {
} else if (this.source_) {
features = this.source_.getFeatures();
}
return /** @type {!Array.<module:ol/Feature~Feature>|!module:ol/Collection~Collection.<module:ol/Feature~Feature>} */ (features);
return (
/** @type {!Array.<module:ol/Feature>|!module:ol/Collection.<module:ol/Feature>} */ (features)
);
};
/**
* @param {module:ol/source/Vector~Vector.Event|module:ol/Collection~CollectionEvent} evt Event.
* @param {module:ol/source/Vector~Vector|module:ol/Collection~CollectionEvent} evt Event.
* @private
*/
Snap.prototype.handleFeatureAdd_ = function(evt) {
@@ -253,12 +255,12 @@ Snap.prototype.handleFeatureAdd_ = function(evt) {
} else if (evt instanceof CollectionEvent) {
feature = evt.element;
}
this.addFeature(/** @type {module:ol/Feature~Feature} */ (feature));
this.addFeature(/** @type {module:ol/Feature} */ (feature));
};
/**
* @param {module:ol/source/Vector~Vector.Event|module:ol/Collection~CollectionEvent} evt Event.
* @param {module:ol/source/Vector~Vector|module:ol/Collection~CollectionEvent} evt Event.
* @private
*/
Snap.prototype.handleFeatureRemove_ = function(evt) {
@@ -268,16 +270,16 @@ Snap.prototype.handleFeatureRemove_ = function(evt) {
} else if (evt instanceof CollectionEvent) {
feature = evt.element;
}
this.removeFeature(/** @type {module:ol/Feature~Feature} */ (feature));
this.removeFeature(/** @type {module:ol/Feature} */ (feature));
};
/**
* @param {module:ol/events/Event~Event} evt Event.
* @param {module:ol/events/Event} evt Event.
* @private
*/
Snap.prototype.handleFeatureChange_ = function(evt) {
const feature = /** @type {module:ol/Feature~Feature} */ (evt.target);
const feature = /** @type {module:ol/Feature} */ (evt.target);
if (this.handlingDownUpSequence) {
const uid = getUid(feature);
if (!(uid in this.pendingFeatures_)) {
@@ -291,7 +293,7 @@ Snap.prototype.handleFeatureChange_ = function(evt) {
/**
* Remove a feature from the collection of features that we may snap to.
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/Feature} feature Feature
* @param {boolean=} opt_unlisten Whether to unlisten to the feature change
* or not. Defaults to `true`.
* @api
@@ -365,7 +367,7 @@ Snap.prototype.shouldStopEvent = FALSE;
/**
* @param {module:ol~Pixel} pixel Pixel
* @param {module:ol/coordinate~Coordinate} pixelCoordinate Coordinate
* @param {module:ol/PluggableMap~PluggableMap} map Map.
* @param {module:ol/PluggableMap} map Map.
* @return {module:ol/interaction/Snap~Result} Snap result
*/
Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
@@ -412,7 +414,7 @@ Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
} else if (this.edge_) {
if (isCircle) {
vertex = closestOnCircle(pixelCoordinate,
/** @type {module:ol/geom/Circle~Circle} */ (segments[0].feature.getGeometry()));
/** @type {module:ol/geom/Circle} */ (segments[0].feature.getGeometry()));
} else {
vertex = closestOnSegment(pixelCoordinate, closestSegment);
}
@@ -437,16 +439,18 @@ Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])];
}
}
return /** @type {module:ol/interaction/Snap~Result} */ ({
snapped: snapped,
vertex: vertex,
vertexPixel: vertexPixel
});
return (
/** @type {module:ol/interaction/Snap~Result} */ ({
snapped: snapped,
vertex: vertex,
vertexPixel: vertexPixel
})
);
};
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/Feature} feature Feature
* @private
*/
Snap.prototype.updateFeature_ = function(feature) {
@@ -456,8 +460,8 @@ Snap.prototype.updateFeature_ = function(feature) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/Circle~Circle} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Circle} geometry Geometry.
* @private
*/
Snap.prototype.writeCircleGeometry_ = function(feature, geometry) {
@@ -475,8 +479,8 @@ Snap.prototype.writeCircleGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/GeometryCollection~GeometryCollection} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/GeometryCollection} geometry Geometry.
* @private
*/
Snap.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) {
@@ -491,8 +495,8 @@ Snap.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/LineString~LineString} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/LineString} geometry Geometry.
* @private
*/
Snap.prototype.writeLineStringGeometry_ = function(feature, geometry) {
@@ -509,8 +513,8 @@ Snap.prototype.writeLineStringGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiLineString~MultiLineString} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiLineString} geometry Geometry.
* @private
*/
Snap.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
@@ -530,8 +534,8 @@ Snap.prototype.writeMultiLineStringGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiPoint~MultiPoint} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPoint} geometry Geometry.
* @private
*/
Snap.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
@@ -548,8 +552,8 @@ Snap.prototype.writeMultiPointGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/MultiPolygon~MultiPolygon} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/MultiPolygon} geometry Geometry.
* @private
*/
Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
@@ -572,8 +576,8 @@ Snap.prototype.writeMultiPolygonGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/Point~Point} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Point} geometry Geometry.
* @private
*/
Snap.prototype.writePointGeometry_ = function(feature, geometry) {
@@ -587,8 +591,8 @@ Snap.prototype.writePointGeometry_ = function(feature, geometry) {
/**
* @param {module:ol/Feature~Feature} feature Feature
* @param {module:ol/geom/Polygon~Polygon} geometry Geometry.
* @param {module:ol/Feature} feature Feature
* @param {module:ol/geom/Polygon} geometry Geometry.
* @private
*/
Snap.prototype.writePolygonGeometry_ = function(feature, geometry) {
@@ -609,9 +613,9 @@ Snap.prototype.writePolygonGeometry_ = function(feature, geometry) {
/**
* Handle all pointer events events.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt A move event.
* @param {module:ol/MapBrowserEvent} evt A move event.
* @return {boolean} Pass the event to other interactions.
* @this {module:ol/interaction/Snap~Snap}
* @this {module:ol/interaction/Snap}
*/
export function handleEvent(evt) {
const result = this.snapTo(evt.pixel, evt.coordinate, evt.map);
@@ -624,9 +628,9 @@ export function handleEvent(evt) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} evt Event.
* @param {module:ol/MapBrowserPointerEvent} evt Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Snap~Snap}
* @this {module:ol/interaction/Snap}
*/
function handleUpEvent(evt) {
const featuresToUpdate = getValues(this.pendingFeatures_);
@@ -643,7 +647,7 @@ function handleUpEvent(evt) {
* @param {module:ol/interaction/Snap~SegmentData} a The first segment data.
* @param {module:ol/interaction/Snap~SegmentData} b The second segment data.
* @return {number} The difference in distance.
* @this {module:ol/interaction/Snap~Snap}
* @this {module:ol/interaction/Snap}
*/
function sortByDistance(a, b) {
const deltaA = squaredDistanceToSegment(this.pixelCoordinate_, a.segment);

View File

@@ -39,9 +39,9 @@ const TranslateEventType = {
/**
* @typedef {Object} Options
* @property {module:ol/Collection~Collection.<module:ol/Feature~Feature>} [features] Only features contained in this collection will be able to be translated. If
* @property {module:ol/Collection.<module:ol/Feature>} [features] Only features contained in this collection will be able to be translated. If
* not specified, all features on the map will be able to be translated.
* @property {Array.<module:ol/layer/Layer~Layer>|function(module:ol/layer/Layer~Layer): boolean} [layers] A list of layers from which features should be
* @property {Array.<module:ol/layer/Layer>|function(module:ol/layer/Layer): 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
@@ -58,10 +58,10 @@ const TranslateEventType = {
* are instances of this type.
*
* @constructor
* @extends {module:ol/events/Event~Event}
* @extends {module:ol/events/Event}
* @implements {oli.interaction.TranslateEvent}
* @param {module:ol/interaction/Translate~TranslateEventType} type Type.
* @param {module:ol/Collection~Collection.<module:ol/Feature~Feature>} features The features translated.
* @param {module:ol/Collection.<module:ol/Feature>} features The features translated.
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
*/
export const TranslateEvent = function(type, features, coordinate) {
@@ -70,7 +70,7 @@ export const TranslateEvent = function(type, features, coordinate) {
/**
* The features being translated.
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @api
*/
this.features = features;
@@ -92,7 +92,7 @@ inherits(TranslateEvent, Event);
* Interaction for translating (moving) features.
*
* @constructor
* @extends {module:ol/interaction/Pointer~PointerInteraction}
* @extends {module:ol/interaction/Pointer}
* @fires module:ol/interaction/Translate~TranslateEvent
* @param {module:ol/interaction/Translate~Options=} opt_options Options.
* @api
@@ -116,12 +116,12 @@ const Translate = function(opt_options) {
/**
* @type {module:ol/Collection~Collection.<module:ol/Feature~Feature>}
* @type {module:ol/Collection.<module:ol/Feature>}
* @private
*/
this.features_ = options.features !== undefined ? options.features : null;
/** @type {function(module:ol/layer/Layer~Layer): boolean} */
/** @type {function(module:ol/layer/Layer): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -138,7 +138,7 @@ const Translate = function(opt_options) {
/**
* @private
* @type {function(module:ol/layer/Layer~Layer): boolean}
* @type {function(module:ol/layer/Layer): boolean}
*/
this.layerFilter_ = layerFilter;
@@ -149,7 +149,7 @@ const Translate = function(opt_options) {
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
/**
* @type {module:ol/Feature~Feature}
* @type {module:ol/Feature}
* @private
*/
this.lastFeature_ = null;
@@ -164,9 +164,9 @@ inherits(Translate, PointerInteraction);
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} event Event.
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @return {boolean} Start drag sequence?
* @this {module:ol/interaction/Translate~Translate}
* @this {module:ol/interaction/Translate}
*/
function handleDownEvent(event) {
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
@@ -187,9 +187,9 @@ function handleDownEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} event Event.
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @return {boolean} Stop drag sequence?
* @this {module:ol/interaction/Translate~Translate}
* @this {module:ol/interaction/Translate}
*/
function handleUpEvent(event) {
if (this.lastCoordinate_) {
@@ -209,8 +209,8 @@ function handleUpEvent(event) {
/**
* @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} event Event.
* @this {module:ol/interaction/Translate~Translate}
* @param {module:ol/MapBrowserPointerEvent} event Event.
* @this {module:ol/interaction/Translate}
*/
function handleDragEvent(event) {
if (this.lastCoordinate_) {
@@ -236,8 +236,8 @@ function handleDragEvent(event) {
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} event Event.
* @this {module:ol/interaction/Translate~Translate}
* @param {module:ol/MapBrowserEvent} event Event.
* @this {module:ol/interaction/Translate}
*/
function handleMoveEvent(event) {
const elem = event.map.getViewport();
@@ -257,8 +257,8 @@ function handleMoveEvent(event) {
* Tests to see if the given coordinates intersects any of our selected
* features.
* @param {module:ol~Pixel} pixel Pixel coordinate to test for intersection.
* @param {module:ol/PluggableMap~PluggableMap} map Map to test the intersection on.
* @return {module:ol/Feature~Feature} Returns the feature found at the specified pixel
* @param {module:ol/PluggableMap} map Map to test the intersection on.
* @return {module:ol/Feature} Returns the feature found at the specified pixel
* coordinates.
* @private
*/
@@ -316,7 +316,7 @@ Translate.prototype.handleActiveChanged_ = function() {
/**
* @param {module:ol/PluggableMap~PluggableMap} oldMap Old map.
* @param {module:ol/PluggableMap} oldMap Old map.
* @private
*/
Translate.prototype.updateState_ = function(oldMap) {