Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -38,9 +38,9 @@ const TranslateEventType = {
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/Collection<module:ol/Feature>} [features] Only features contained in this collection will be able to be translated. If
|
||||
* @property {import("../Collection.js").default<import("../Feature.js").default>} [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>|function(module:ol/layer/Layer): boolean} [layers] A list of layers from which features should be
|
||||
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] A list of layers from which features should be
|
||||
* translated. Alternatively, a filter function can be provided. The
|
||||
* function will be called for each layer in the map and should return
|
||||
* `true` for layers that you want to be translatable. If the option is
|
||||
@@ -58,9 +58,9 @@ const TranslateEventType = {
|
||||
*/
|
||||
export class TranslateEvent extends Event {
|
||||
/**
|
||||
* @param {module:ol/interaction/Translate~TranslateEventType} type Type.
|
||||
* @param {module:ol/Collection<module:ol/Feature>} features The features translated.
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate The event coordinate.
|
||||
* @param {TranslateEventType} type Type.
|
||||
* @param {import("../Collection.js").default<import("../Feature.js").default>} features The features translated.
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
|
||||
*/
|
||||
constructor(type, features, coordinate) {
|
||||
|
||||
@@ -68,7 +68,7 @@ export class TranslateEvent extends Event {
|
||||
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {module:ol/Collection<module:ol/Feature>}
|
||||
* @type {import("../Collection.js").default<import("../Feature.js").default>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
@@ -76,7 +76,7 @@ export class TranslateEvent extends Event {
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
@@ -90,12 +90,12 @@ export class TranslateEvent extends Event {
|
||||
* @classdesc
|
||||
* Interaction for translating (moving) features.
|
||||
*
|
||||
* @fires module:ol/interaction/Translate~TranslateEvent
|
||||
* @fires TranslateEvent
|
||||
* @api
|
||||
*/
|
||||
class Translate extends PointerInteraction {
|
||||
/**
|
||||
* @param {module:ol/interaction/Translate~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
super({
|
||||
@@ -109,19 +109,19 @@ class Translate extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* The last position we translated to.
|
||||
* @type {module:ol/coordinate~Coordinate}
|
||||
* @type {import("../coordinate.js").Coordinate}
|
||||
* @private
|
||||
*/
|
||||
this.lastCoordinate_ = null;
|
||||
|
||||
|
||||
/**
|
||||
* @type {module:ol/Collection<module:ol/Feature>}
|
||||
* @type {import("../Collection.js").default<import("../Feature.js").default>}
|
||||
* @private
|
||||
*/
|
||||
this.features_ = options.features !== undefined ? options.features : null;
|
||||
|
||||
/** @type {function(module:ol/layer/Layer): boolean} */
|
||||
/** @type {function(import("../layer/Layer.js").default): boolean} */
|
||||
let layerFilter;
|
||||
if (options.layers) {
|
||||
if (typeof options.layers === 'function') {
|
||||
@@ -138,7 +138,7 @@ class Translate extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {function(module:ol/layer/Layer): boolean}
|
||||
* @type {function(import("../layer/Layer.js").default): boolean}
|
||||
*/
|
||||
this.layerFilter_ = layerFilter;
|
||||
|
||||
@@ -149,7 +149,7 @@ class Translate extends PointerInteraction {
|
||||
this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
|
||||
|
||||
/**
|
||||
* @type {module:ol/Feature}
|
||||
* @type {import("../Feature.js").default}
|
||||
* @private
|
||||
*/
|
||||
this.lastFeature_ = null;
|
||||
@@ -163,9 +163,9 @@ class Translate extends PointerInteraction {
|
||||
/**
|
||||
* Tests to see if the given coordinates intersects any of our selected
|
||||
* features.
|
||||
* @param {module:ol/pixel~Pixel} pixel Pixel coordinate to test for intersection.
|
||||
* @param {module:ol/PluggableMap} map Map to test the intersection on.
|
||||
* @return {module:ol/Feature} Returns the feature found at the specified pixel
|
||||
* @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
|
||||
* @param {import("../PluggableMap.js").default} map Map to test the intersection on.
|
||||
* @return {import("../Feature.js").default} Returns the feature found at the specified pixel
|
||||
* coordinates.
|
||||
* @private
|
||||
*/
|
||||
@@ -218,7 +218,7 @@ class Translate extends PointerInteraction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/PluggableMap} oldMap Old map.
|
||||
* @param {import("../PluggableMap.js").default} oldMap Old map.
|
||||
* @private
|
||||
*/
|
||||
updateState_(oldMap) {
|
||||
@@ -236,9 +236,9 @@ class Translate extends PointerInteraction {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} event Event.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} Start drag sequence?
|
||||
* @this {module:ol/interaction/Translate}
|
||||
* @this {import("./Translate.js").default}
|
||||
*/
|
||||
function handleDownEvent(event) {
|
||||
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
|
||||
@@ -259,9 +259,9 @@ function handleDownEvent(event) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} event Event.
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @return {boolean} Stop drag sequence?
|
||||
* @this {module:ol/interaction/Translate}
|
||||
* @this {import("./Translate.js").default}
|
||||
*/
|
||||
function handleUpEvent(event) {
|
||||
if (this.lastCoordinate_) {
|
||||
@@ -281,8 +281,8 @@ function handleUpEvent(event) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserPointerEvent} event Event.
|
||||
* @this {module:ol/interaction/Translate}
|
||||
* @param {import("../MapBrowserPointerEvent.js").default} event Event.
|
||||
* @this {import("./Translate.js").default}
|
||||
*/
|
||||
function handleDragEvent(event) {
|
||||
if (this.lastCoordinate_) {
|
||||
@@ -308,8 +308,8 @@ function handleDragEvent(event) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/MapBrowserEvent} event Event.
|
||||
* @this {module:ol/interaction/Translate}
|
||||
* @param {import("../MapBrowserEvent.js").default} event Event.
|
||||
* @this {import("./Translate.js").default}
|
||||
*/
|
||||
function handleMoveEvent(event) {
|
||||
const elem = event.map.getViewport();
|
||||
|
||||
Reference in New Issue
Block a user