Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -13,22 +13,22 @@ import RenderBox from '../render/Box.js';
|
||||
* A function that takes a {@link module:ol/MapBrowserEvent} and two
|
||||
* {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
|
||||
* true should be returned.
|
||||
* @typedef {function(this: ?, module:ol/MapBrowserEvent, module:ol/pixel~Pixel, module:ol/pixel~Pixel):boolean} EndCondition
|
||||
* @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-dragbox'] CSS class name for styling the box.
|
||||
* @property {module:ol/events/condition~Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
|
||||
* to indicate whether that event should be handled.
|
||||
* Default is {@link ol/events/condition~always}.
|
||||
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
|
||||
* `boxEndCondition` function.
|
||||
* @property {module:ol/interaction/DragBox~EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
|
||||
* {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
|
||||
* Default is `true` if the area of the box is bigger than the `minArea` option.
|
||||
* @property {function(this:module:ol/interaction/DragBox, module:ol/MapBrowserEvent)} onBoxEnd Code to execute just
|
||||
* @property {function(this:import("./DragBox.js").default, import("../MapBrowserEvent.js").default)} onBoxEnd Code to execute just
|
||||
* before `boxend` is fired.
|
||||
*/
|
||||
|
||||
@@ -39,21 +39,21 @@ import RenderBox from '../render/Box.js';
|
||||
const DragBoxEventType = {
|
||||
/**
|
||||
* Triggered upon drag box start.
|
||||
* @event module:ol/interaction/DragBox~DragBoxEvent#boxstart
|
||||
* @event DragBoxEvent#boxstart
|
||||
* @api
|
||||
*/
|
||||
BOXSTART: 'boxstart',
|
||||
|
||||
/**
|
||||
* Triggered on drag when box is active.
|
||||
* @event module:ol/interaction/DragBox~DragBoxEvent#boxdrag
|
||||
* @event DragBoxEvent#boxdrag
|
||||
* @api
|
||||
*/
|
||||
BOXDRAG: 'boxdrag',
|
||||
|
||||
/**
|
||||
* Triggered upon drag box end.
|
||||
* @event module:ol/interaction/DragBox~DragBoxEvent#boxend
|
||||
* @event DragBoxEvent#boxend
|
||||
* @api
|
||||
*/
|
||||
BOXEND: 'boxend'
|
||||
@@ -69,8 +69,8 @@ class DragBoxEvent extends Event {
|
||||
|
||||
/**
|
||||
* @param {string} type The event type.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent Originating event.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
|
||||
*/
|
||||
constructor(type, coordinate, mapBrowserEvent) {
|
||||
super(type);
|
||||
@@ -78,14 +78,14 @@ class DragBoxEvent extends Event {
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {module:ol/MapBrowserEvent}
|
||||
* @type {import("../MapBrowserEvent.js").default}
|
||||
* @api
|
||||
*/
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
@@ -106,12 +106,12 @@ class DragBoxEvent extends Event {
|
||||
*
|
||||
* This interaction is only supported for mouse devices.
|
||||
*
|
||||
* @fires module:ol/interaction/DragBox~DragBoxEvent
|
||||
* @fires DragBoxEvent
|
||||
* @api
|
||||
*/
|
||||
class DragBox extends PointerInteraction {
|
||||
/**
|
||||
* @param {module:ol/interaction/DragBox~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -124,7 +124,7 @@ class DragBox extends PointerInteraction {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @type {module:ol/render/Box}
|
||||
* @type {import("../render/Box.js").default}
|
||||
* @private
|
||||
*/
|
||||
this.box_ = new RenderBox(options.className || 'ol-dragbox');
|
||||
@@ -137,26 +137,26 @@ class DragBox extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Function to execute just before `onboxend` is fired
|
||||
* @type {function(this:module:ol/interaction/DragBox, module:ol/MapBrowserEvent)}
|
||||
* @type {function(this:import("./DragBox.js").default, import("../MapBrowserEvent.js").default)}
|
||||
* @private
|
||||
*/
|
||||
this.onBoxEnd_ = options.onBoxEnd ? options.onBoxEnd : VOID;
|
||||
|
||||
/**
|
||||
* @type {module:ol/pixel~Pixel}
|
||||
* @type {import("../pixel.js").Pixel}
|
||||
* @private
|
||||
*/
|
||||
this.startPixel_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/events/condition~Condition}
|
||||
* @type {import("../events/condition.js").Condition}
|
||||
*/
|
||||
this.condition_ = options.condition ? options.condition : always;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/interaction/DragBox~EndCondition}
|
||||
* @type {EndCondition}
|
||||
*/
|
||||
this.boxEndCondition_ = options.boxEndCondition ?
|
||||
options.boxEndCondition : defaultBoxEndCondition;
|
||||
@@ -164,7 +164,7 @@ class DragBox extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Returns geometry of last drawn box.
|
||||
* @return {module:ol/geom/Polygon} Geometry.
|
||||
* @return {import("../geom/Polygon.js").default} Geometry.
|
||||
* @api
|
||||
*/
|
||||
getGeometry() {
|
||||
@@ -176,12 +176,12 @@ class DragBox extends PointerInteraction {
|
||||
/**
|
||||
* The default condition for determining whether the boxend event
|
||||
* should fire.
|
||||
* @param {module:ol/MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
|
||||
* leading to the box end.
|
||||
* @param {module:ol/pixel~Pixel} startPixel The starting pixel of the box.
|
||||
* @param {module:ol/pixel~Pixel} endPixel The end pixel of the box.
|
||||
* @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
|
||||
* @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
|
||||
* @return {boolean} Whether or not the boxend condition should be fired.
|
||||
* @this {module:ol/interaction/DragBox}
|
||||
* @this {import("./DragBox.js").default}
|
||||
*/
|
||||
function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
|
||||
const width = endPixel[0] - startPixel[0];
|
||||
@@ -191,8 +191,8 @@ function defaultBoxEndCondition(mapBrowserEvent, startPixel, endPixel) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
|
||||
* @this {module:ol/interaction/DragBox}
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @this {import("./DragBox.js").default}
|
||||
*/
|
||||
function handleDragEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -207,9 +207,9 @@ function handleDragEvent(mapBrowserEvent) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} Stop drag sequence?
|
||||
* @this {module:ol/interaction/DragBox}
|
||||
* @this {import("./DragBox.js").default}
|
||||
*/
|
||||
function handleUpEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
@@ -228,9 +228,9 @@ function handleUpEvent(mapBrowserEvent) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} mapBrowserEvent Event.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
|
||||
* @return {boolean} Start drag sequence?
|
||||
* @this {module:ol/interaction/DragBox}
|
||||
* @this {import("./DragBox.js").default}
|
||||
*/
|
||||
function handleDownEvent(mapBrowserEvent) {
|
||||
if (!mouseOnly(mapBrowserEvent)) {
|
||||
|
||||
Reference in New Issue
Block a user