From a5f5c06af3f18de1c318c6b159ecfbcf8205059b Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 5 Sep 2018 13:59:12 +0200 Subject: [PATCH 1/2] Cast 'originalEvent' in interactions --- src/ol/interaction/DoubleClickZoom.js | 2 +- src/ol/interaction/KeyboardPan.js | 2 +- src/ol/interaction/KeyboardZoom.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ol/interaction/DoubleClickZoom.js b/src/ol/interaction/DoubleClickZoom.js index 2e75ab4062..32fd5bc897 100644 --- a/src/ol/interaction/DoubleClickZoom.js +++ b/src/ol/interaction/DoubleClickZoom.js @@ -55,8 +55,8 @@ class DoubleClickZoom extends Interaction { */ function handleEvent(mapBrowserEvent) { let stopEvent = false; - const browserEvent = mapBrowserEvent.originalEvent; if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) { + const browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent); const map = mapBrowserEvent.map; const anchor = mapBrowserEvent.coordinate; const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; diff --git a/src/ol/interaction/KeyboardPan.js b/src/ol/interaction/KeyboardPan.js index 6aac23ee90..1a89c7abdd 100644 --- a/src/ol/interaction/KeyboardPan.js +++ b/src/ol/interaction/KeyboardPan.js @@ -92,7 +92,7 @@ class KeyboardPan extends Interaction { function handleEvent(mapBrowserEvent) { let stopEvent = false; if (mapBrowserEvent.type == EventType.KEYDOWN) { - const keyEvent = mapBrowserEvent.originalEvent; + const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent); const keyCode = keyEvent.keyCode; if (this.condition_(mapBrowserEvent) && (keyCode == KeyCode.DOWN || diff --git a/src/ol/interaction/KeyboardZoom.js b/src/ol/interaction/KeyboardZoom.js index 4053433564..61f212111f 100644 --- a/src/ol/interaction/KeyboardZoom.js +++ b/src/ol/interaction/KeyboardZoom.js @@ -77,7 +77,7 @@ function handleEvent(mapBrowserEvent) { let stopEvent = false; if (mapBrowserEvent.type == EventType.KEYDOWN || mapBrowserEvent.type == EventType.KEYPRESS) { - const keyEvent = mapBrowserEvent.originalEvent; + const keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent); const charCode = keyEvent.charCode; if (this.condition_(mapBrowserEvent) && (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) { From 71328530fe35d31d52756c303e80bbb00fbbd9bc Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 5 Sep 2018 16:40:45 +0200 Subject: [PATCH 2/2] Remove unnecessary 'function' in jsdoc blocks --- src/ol/events/Event.js | 2 -- src/ol/events/Target.js | 1 - src/ol/events/condition.js | 2 -- src/ol/format/TextFeature.js | 3 --- src/ol/format/XMLFeature.js | 1 - src/ol/geom/Geometry.js | 4 +--- 6 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/ol/events/Event.js b/src/ol/events/Event.js index c4c494384e..ad1be5ce5f 100644 --- a/src/ol/events/Event.js +++ b/src/ol/events/Event.js @@ -41,7 +41,6 @@ class Event { /** * Stop event propagation. - * @function * @api */ preventDefault() { @@ -50,7 +49,6 @@ class Event { /** * Stop event propagation. - * @function * @api */ stopPropagation() { diff --git a/src/ol/events/Target.js b/src/ol/events/Target.js index cb51b211ec..ffc8d4257e 100644 --- a/src/ol/events/Target.js +++ b/src/ol/events/Target.js @@ -76,7 +76,6 @@ class Target extends Disposable { * import("./Event.js").default|string} event Event object. * @return {boolean|undefined} `false` if anyone called preventDefault on the * event object or if any of the listeners returned false. - * @function * @api */ dispatchEvent(event) { diff --git a/src/ol/events/condition.js b/src/ol/events/condition.js index 69f5f90a90..e004729932 100644 --- a/src/ol/events/condition.js +++ b/src/ol/events/condition.js @@ -67,7 +67,6 @@ export const focus = function(event) { * * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. * @return {boolean} True. - * @function * @api */ export const always = TRUE; @@ -106,7 +105,6 @@ export const mouseActionButton = function(mapBrowserEvent) { * * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. * @return {boolean} False. - * @function * @api */ export const never = FALSE; diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index 2d122248d4..d5f9b09933 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -90,7 +90,6 @@ class TextFeature extends FeatureFormat { /** * Read the projection from the source. * - * @function * @param {Document|Node|Object|string} source Source. * @return {import("../proj/Projection.js").default} Projection. * @api @@ -111,7 +110,6 @@ class TextFeature extends FeatureFormat { /** * Encode a feature as a string. * - * @function * @param {import("../Feature.js").default} feature Feature. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {string} Encoded feature. @@ -154,7 +152,6 @@ class TextFeature extends FeatureFormat { /** * Write a single geometry. * - * @function * @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {string} Geometry. diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 363a3b44d8..5a669085b2 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -79,7 +79,6 @@ class XMLFeature extends FeatureFormat { /** * Read all features from a feature collection. * - * @function * @param {Document|Node|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Options. * @return {Array} Features. diff --git a/src/ol/geom/Geometry.js b/src/ol/geom/Geometry.js index 9ca464b0fa..b6f99deb5b 100644 --- a/src/ol/geom/Geometry.js +++ b/src/ol/geom/Geometry.js @@ -158,10 +158,8 @@ class Geometry extends BaseObject { * https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm * Douglas Peucker} algorithm. For polygons, a quantization-based * simplification is used to preserve topology. - * @function * @param {number} tolerance The tolerance distance for simplification. - * @return {import("./Geometry.js").default} A new, simplified version of the original - * geometry. + * @return {import("./Geometry.js").default} A new, simplified version of the original geometry. * @api */ simplify(tolerance) {