Remove opt_ prefix
This commit is contained in:
@@ -17,12 +17,12 @@ import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
*/
|
||||
class DoubleClickZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
options = options ? options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -44,10 +44,10 @@ export class DragAndDropEvent extends Event {
|
||||
/**
|
||||
* @param {DragAndDropEventType} type Type.
|
||||
* @param {File} file File.
|
||||
* @param {Array<import("../Feature.js").default>} [opt_features] Features.
|
||||
* @param {import("../proj/Projection.js").default} [opt_projection] Projection.
|
||||
* @param {Array<import("../Feature.js").default>} [features] Features.
|
||||
* @param {import("../proj/Projection.js").default} [projection] Projection.
|
||||
*/
|
||||
constructor(type, file, opt_features, opt_projection) {
|
||||
constructor(type, file, features, projection) {
|
||||
super(type);
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export class DragAndDropEvent extends Event {
|
||||
* @type {Array<import("../Feature.js").FeatureLike>|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.features = opt_features;
|
||||
this.features = features;
|
||||
|
||||
/**
|
||||
* The dropped file.
|
||||
@@ -69,7 +69,7 @@ export class DragAndDropEvent extends Event {
|
||||
* @type {import("../proj/Projection.js").default|undefined}
|
||||
* @api
|
||||
*/
|
||||
this.projection = opt_projection;
|
||||
this.projection = projection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +93,10 @@ export class DragAndDropEvent extends Event {
|
||||
*/
|
||||
class DragAndDrop extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super({
|
||||
handleEvent: TRUE,
|
||||
|
||||
@@ -117,9 +117,9 @@ export class DragBoxEvent extends Event {
|
||||
*/
|
||||
class DragBox extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
/***
|
||||
@@ -137,7 +137,7 @@ class DragBox extends PointerInteraction {
|
||||
*/
|
||||
this.un;
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
options = options ? options : {};
|
||||
|
||||
/**
|
||||
* @type {import("../render/Box.js").default}
|
||||
|
||||
@@ -34,14 +34,14 @@ import {
|
||||
*/
|
||||
class DragPan extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super({
|
||||
stopDown: FALSE,
|
||||
});
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
options = options ? options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -30,10 +30,10 @@ import {disable} from '../rotationconstraint.js';
|
||||
*/
|
||||
class DragRotate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super({
|
||||
stopDown: FALSE,
|
||||
|
||||
@@ -26,10 +26,10 @@ import {mouseOnly, shiftKeyOnly} from '../events/condition.js';
|
||||
*/
|
||||
class DragRotateAndZoom extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super(/** @type {import("./Pointer.js").Options} */ (options));
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ import {shiftKeyOnly} from '../events/condition.js';
|
||||
*/
|
||||
class DragZoom extends DragBox {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
const condition = options.condition ? options.condition : shiftKeyOnly;
|
||||
|
||||
|
||||
+15
-13
@@ -1179,17 +1179,17 @@ function getDefaultStyleFunction() {
|
||||
* Create a `geometryFunction` for `type: 'Circle'` that will create a regular
|
||||
* polygon with a user specified number of sides and start angle instead of a
|
||||
* {@link import("../geom/Circle.js").Circle} geometry.
|
||||
* @param {number} [opt_sides] Number of sides of the regular polygon.
|
||||
* @param {number} [sides] Number of sides of the regular polygon.
|
||||
* Default is 32.
|
||||
* @param {number} [opt_angle] Angle of the first point in counter-clockwise
|
||||
* @param {number} [angle] Angle of the first point in counter-clockwise
|
||||
* radians. 0 means East.
|
||||
* Default is the angle defined by the heading from the center of the
|
||||
* regular polygon to the current pointer position.
|
||||
* @return {GeometryFunction} Function that draws a polygon.
|
||||
* @api
|
||||
*/
|
||||
export function createRegularPolygon(opt_sides, opt_angle) {
|
||||
return function (coordinates, opt_geometry, projection) {
|
||||
export function createRegularPolygon(sides, angle) {
|
||||
return function (coordinates, geometry, projection) {
|
||||
const center = fromUserCoordinate(
|
||||
/** @type {LineCoordType} */ (coordinates)[0],
|
||||
projection
|
||||
@@ -1199,17 +1199,20 @@ export function createRegularPolygon(opt_sides, opt_angle) {
|
||||
projection
|
||||
);
|
||||
const radius = Math.sqrt(squaredCoordinateDistance(center, end));
|
||||
const geometry = opt_geometry
|
||||
? /** @type {Polygon} */ (opt_geometry)
|
||||
: fromCircle(new Circle(center), opt_sides);
|
||||
geometry = geometry || fromCircle(new Circle(center), sides);
|
||||
|
||||
let angle = opt_angle;
|
||||
if (!opt_angle && opt_angle !== 0) {
|
||||
let internalAngle = angle;
|
||||
if (!angle && angle !== 0) {
|
||||
const x = end[0] - center[0];
|
||||
const y = end[1] - center[1];
|
||||
angle = Math.atan2(y, x);
|
||||
internalAngle = Math.atan2(y, x);
|
||||
}
|
||||
makeRegular(geometry, center, radius, angle);
|
||||
makeRegular(
|
||||
/** @type {Polygon} */ (geometry),
|
||||
center,
|
||||
radius,
|
||||
internalAngle
|
||||
);
|
||||
|
||||
const userProjection = getUserProjection();
|
||||
if (userProjection) {
|
||||
@@ -1227,7 +1230,7 @@ export function createRegularPolygon(opt_sides, opt_angle) {
|
||||
* @api
|
||||
*/
|
||||
export function createBox() {
|
||||
return function (coordinates, opt_geometry, projection) {
|
||||
return function (coordinates, geometry, projection) {
|
||||
const extent = boundingExtent(
|
||||
/** @type {LineCoordType} */ ([
|
||||
coordinates[0],
|
||||
@@ -1245,7 +1248,6 @@ export function createBox() {
|
||||
getBottomLeft(extent),
|
||||
],
|
||||
];
|
||||
let geometry = opt_geometry;
|
||||
if (geometry) {
|
||||
geometry.setCoordinates(boxCoordinates);
|
||||
} else {
|
||||
|
||||
@@ -94,10 +94,10 @@ export class ExtentEvent extends Event {
|
||||
*/
|
||||
class Extent extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options || {};
|
||||
constructor(options) {
|
||||
options = options || {};
|
||||
|
||||
super(/** @type {import("./Pointer.js").Options} */ (options));
|
||||
|
||||
@@ -166,8 +166,8 @@ class Extent extends PointerInteraction {
|
||||
*/
|
||||
this.vertexFeature_ = null;
|
||||
|
||||
if (!opt_options) {
|
||||
opt_options = {};
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,10 +178,10 @@ class Extent extends PointerInteraction {
|
||||
this.extentOverlay_ = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
useSpatialIndex: false,
|
||||
wrapX: !!opt_options.wrapX,
|
||||
wrapX: !!options.wrapX,
|
||||
}),
|
||||
style: opt_options.boxStyle
|
||||
? opt_options.boxStyle
|
||||
style: options.boxStyle
|
||||
? options.boxStyle
|
||||
: getDefaultExtentStyleFunction(),
|
||||
updateWhileAnimating: true,
|
||||
updateWhileInteracting: true,
|
||||
@@ -195,17 +195,17 @@ class Extent extends PointerInteraction {
|
||||
this.vertexOverlay_ = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
useSpatialIndex: false,
|
||||
wrapX: !!opt_options.wrapX,
|
||||
wrapX: !!options.wrapX,
|
||||
}),
|
||||
style: opt_options.pointerStyle
|
||||
? opt_options.pointerStyle
|
||||
style: options.pointerStyle
|
||||
? options.pointerStyle
|
||||
: getDefaultPointerStyleFunction(),
|
||||
updateWhileAnimating: true,
|
||||
updateWhileInteracting: true,
|
||||
});
|
||||
|
||||
if (opt_options.extent) {
|
||||
this.setExtent(opt_options.extent);
|
||||
if (options.extent) {
|
||||
this.setExtent(options.extent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ import {easeOut, linear} from '../easing.js';
|
||||
*/
|
||||
class Interaction extends BaseObject {
|
||||
/**
|
||||
* @param {InteractionOptions} [opt_options] Options.
|
||||
* @param {InteractionOptions} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
/***
|
||||
@@ -60,8 +60,8 @@ class Interaction extends BaseObject {
|
||||
*/
|
||||
this.un;
|
||||
|
||||
if (opt_options && opt_options.handleEvent) {
|
||||
this.handleEvent = opt_options.handleEvent;
|
||||
if (options && options.handleEvent) {
|
||||
this.handleEvent = options.handleEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,14 +126,14 @@ class Interaction extends BaseObject {
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {import("../coordinate.js").Coordinate} delta Delta.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
* @param {number} [duration] Duration.
|
||||
*/
|
||||
export function pan(view, delta, opt_duration) {
|
||||
export function pan(view, delta, duration) {
|
||||
const currentCenter = view.getCenterInternal();
|
||||
if (currentCenter) {
|
||||
const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
|
||||
view.animateInternal({
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
duration: duration !== undefined ? duration : 250,
|
||||
easing: linear,
|
||||
center: view.getConstrainedCenter(center),
|
||||
});
|
||||
@@ -143,10 +143,10 @@ export function pan(view, delta, opt_duration) {
|
||||
/**
|
||||
* @param {import("../View.js").default} view View.
|
||||
* @param {number} delta Delta from previous zoom level.
|
||||
* @param {import("../coordinate.js").Coordinate} [opt_anchor] Anchor coordinate in the user projection.
|
||||
* @param {number} [opt_duration] Duration.
|
||||
* @param {import("../coordinate.js").Coordinate} [anchor] Anchor coordinate in the user projection.
|
||||
* @param {number} [duration] Duration.
|
||||
*/
|
||||
export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
|
||||
export function zoomByDelta(view, delta, anchor, duration) {
|
||||
const currentZoom = view.getZoom();
|
||||
|
||||
if (currentZoom === undefined) {
|
||||
@@ -161,8 +161,8 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) {
|
||||
}
|
||||
view.animate({
|
||||
resolution: newResolution,
|
||||
anchor: opt_anchor,
|
||||
duration: opt_duration !== undefined ? opt_duration : 250,
|
||||
anchor: anchor,
|
||||
duration: duration !== undefined ? duration : 250,
|
||||
easing: easeOut,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ import {rotate as rotateCoordinate} from '../coordinate.js';
|
||||
*/
|
||||
class KeyboardPan extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
const options = opt_options || {};
|
||||
options = options || {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -30,12 +30,12 @@ import {targetNotEditable} from '../events/condition.js';
|
||||
*/
|
||||
class KeyboardZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
options = options ? options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -70,14 +70,14 @@ function differentArray(a, b) {
|
||||
*/
|
||||
class Link extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Link options.
|
||||
* @param {Options} [options] Link options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
const options = Object.assign(
|
||||
options = Object.assign(
|
||||
{animate: true, replace: false, prefix: ''},
|
||||
opt_options || {}
|
||||
options || {}
|
||||
);
|
||||
|
||||
let animationOptions;
|
||||
|
||||
@@ -1159,11 +1159,11 @@ class Modify extends PointerInteraction {
|
||||
/**
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel
|
||||
* @param {import("../Map.js").default} map Map.
|
||||
* @param {import("../coordinate.js").Coordinate} [opt_coordinate] The pixel Coordinate.
|
||||
* @param {import("../coordinate.js").Coordinate} [coordinate] The pixel Coordinate.
|
||||
* @private
|
||||
*/
|
||||
handlePointerAtPixel_(pixel, map, opt_coordinate) {
|
||||
const pixelCoordinate = opt_coordinate || map.getCoordinateFromPixel(pixel);
|
||||
handlePointerAtPixel_(pixel, map, coordinate) {
|
||||
const pixelCoordinate = coordinate || map.getCoordinateFromPixel(pixel);
|
||||
const projection = map.getView().getProjection();
|
||||
const sortByDistance = function (a, b) {
|
||||
return (
|
||||
|
||||
@@ -37,10 +37,10 @@ import {clamp} from '../math.js';
|
||||
*/
|
||||
class MouseWheelZoom extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super(
|
||||
/** @type {import("./Interaction.js").InteractionOptions} */ (options)
|
||||
|
||||
@@ -22,10 +22,10 @@ import {disable} from '../rotationconstraint.js';
|
||||
*/
|
||||
class PinchRotate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
const pointerOptions = /** @type {import("./Pointer.js").Options} */ (
|
||||
options
|
||||
|
||||
@@ -19,10 +19,10 @@ import {FALSE} from '../functions.js';
|
||||
*/
|
||||
class PinchZoom extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
const pointerOptions = /** @type {import("./Pointer.js").Options} */ (
|
||||
options
|
||||
|
||||
@@ -44,10 +44,10 @@ import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
*/
|
||||
class PointerInteraction extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super(
|
||||
/** @type {import("./Interaction.js").InteractionOptions} */ (options)
|
||||
|
||||
@@ -158,9 +158,9 @@ const originalFeatureStyles = {};
|
||||
*/
|
||||
class Select extends Interaction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
constructor(options) {
|
||||
super();
|
||||
|
||||
/***
|
||||
@@ -178,7 +178,7 @@ class Select extends Interaction {
|
||||
*/
|
||||
this.un;
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
options = options ? options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -92,10 +92,10 @@ const tempSegment = [];
|
||||
*/
|
||||
class Snap extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
const pointerOptions = /** @type {import("./Pointer.js").Options} */ (
|
||||
options
|
||||
@@ -199,12 +199,12 @@ class Snap extends PointerInteraction {
|
||||
/**
|
||||
* Add a feature to the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature.
|
||||
* @param {boolean} [opt_listen] Whether to listen to the feature change or not
|
||||
* @param {boolean} [register] Whether to listen to the feature change or not
|
||||
* Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
addFeature(feature, opt_listen) {
|
||||
const register = opt_listen !== undefined ? opt_listen : true;
|
||||
addFeature(feature, register) {
|
||||
register = register !== undefined ? register : true;
|
||||
const feature_uid = getUid(feature);
|
||||
const geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
@@ -337,12 +337,12 @@ class Snap extends PointerInteraction {
|
||||
/**
|
||||
* Remove a feature from the collection of features that we may snap to.
|
||||
* @param {import("../Feature.js").default} feature Feature
|
||||
* @param {boolean} [opt_unlisten] Whether to unlisten to the feature change
|
||||
* @param {boolean} [unlisten] Whether to unlisten to the feature change
|
||||
* or not. Defaults to `true`.
|
||||
* @api
|
||||
*/
|
||||
removeFeature(feature, opt_unlisten) {
|
||||
const unregister = opt_unlisten !== undefined ? opt_unlisten : true;
|
||||
removeFeature(feature, unlisten) {
|
||||
const unregister = unlisten !== undefined ? unlisten : true;
|
||||
const feature_uid = getUid(feature);
|
||||
const extent = this.indexedFeaturesExtents_[feature_uid];
|
||||
if (extent) {
|
||||
|
||||
@@ -131,10 +131,10 @@ export class TranslateEvent extends Event {
|
||||
*/
|
||||
class Translate extends PointerInteraction {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
* @param {Options} [options] Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
constructor(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
super(/** @type {import("./Pointer.js").Options} */ (options));
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ import PinchZoom from './PinchZoom.js';
|
||||
* * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
|
||||
* * {@link module:ol/interaction/DragZoom~DragZoom}
|
||||
*
|
||||
* @param {DefaultsOptions} [opt_options] Defaults options.
|
||||
* @param {DefaultsOptions} [options] Defaults options.
|
||||
* @return {Collection<import("./Interaction.js").default>}
|
||||
* A collection of interactions to be used with the {@link module:ol/Map~Map}
|
||||
* constructor's `interactions` option.
|
||||
* @api
|
||||
*/
|
||||
export function defaults(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
export function defaults(options) {
|
||||
options = options ? options : {};
|
||||
|
||||
/** @type {Collection<import("./Interaction.js").default>} */
|
||||
const interactions = new Collection();
|
||||
|
||||
Reference in New Issue
Block a user