diff --git a/externs/olx.js b/externs/olx.js index 03989e6654..07e49b02c8 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -46,64 +46,6 @@ olx.interaction.TranslateOptions.prototype.layers; olx.interaction.TranslateOptions.prototype.hitTolerance; -/** - * @typedef {{handleDownEvent: (function(ol.MapBrowserPointerEvent):boolean|undefined), - * handleDragEvent: (function(ol.MapBrowserPointerEvent)|undefined), - * handleEvent: (function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean|undefined), - * handleMoveEvent: (function(ol.MapBrowserPointerEvent)|undefined), - * handleUpEvent: (function(ol.MapBrowserPointerEvent):boolean|undefined)}} - */ -olx.interaction.PointerOptions; - - -/** - * Function handling "down" events. If the function returns `true` then a drag - * sequence is started. - * @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)} - * @api - */ -olx.interaction.PointerOptions.prototype.handleDownEvent; - - -/** - * Function handling "drag" events. This function is called on "move" events - * during a drag sequence. - * @type {(function(ol.MapBrowserPointerEvent)|undefined)} - * @api - */ -olx.interaction.PointerOptions.prototype.handleDragEvent; - - -/** - * 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. - * @type {(function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean|undefined)} - * @api - */ -olx.interaction.PointerOptions.prototype.handleEvent; - - -/** - * 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). - * @type {(function(ol.MapBrowserPointerEvent)|undefined)} - * @api - */ -olx.interaction.PointerOptions.prototype.handleMoveEvent; - - -/** - * Function handling "up" events. If the function returns `false` then the - * current drag sequence is stopped. - * @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)} - * @api - */ -olx.interaction.PointerOptions.prototype.handleUpEvent; - - /** * @typedef {{addCondition: (ol.EventsConditionType|undefined), * condition: (ol.EventsConditionType|undefined), diff --git a/externs/xol.js b/externs/xol.js index 9efaac4e4c..9f8681b3a7 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -14,24 +14,6 @@ */ -/** - * @typedef {Object} interaction_PointerOptions - * @property {(function(ol.MapBrowserPointerEvent):boolean|undefined)} handleDownEvent Function handling "down" events. If the function returns `true` then a drag - * sequence is started. - * @property {(function(ol.MapBrowserPointerEvent)|undefined)} handleDragEvent Function handling "drag" events. This function is called on "move" events - * during a drag sequence. - * @property {(function(module:ol/MapBrowserEvent~MapBrowserEvent):boolean|undefined)} 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(ol.MapBrowserPointerEvent)|undefined)} 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(ol.MapBrowserPointerEvent):boolean|undefined)} handleUpEvent Function handling "up" events. If the function returns `false` then the - * current drag sequence is stopped. - */ - - /** * @typedef {Object} interaction_SelectOptions * @property {ol.EventsConditionType|undefined} addCondition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index 1f0cb0b515..ab0c161bb1 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -10,35 +10,58 @@ import {getValues} from '../obj.js'; /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.Pointer} + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. + * @this {module:ol/interaction/Pointer~Pointer} */ const handleDragEvent = UNDEFINED; /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. * @return {boolean} Capture dragging. - * @this {ol.interaction.Pointer} + * @this {module:ol/interaction/Pointer~Pointer} */ const handleUpEvent = FALSE; /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. * @return {boolean} Capture dragging. - * @this {ol.interaction.Pointer} + * @this {module:ol/interaction/Pointer~Pointer} */ const handleDownEvent = FALSE; /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. - * @this {ol.interaction.Pointer} + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. + * @this {module:ol/interaction/Pointer~Pointer} */ const handleMoveEvent = UNDEFINED; +/** + * @typedef {Object} Options + * @property {(function(module:ol/MapBrowserPointerEvent~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] + * Function handling "drag" events. This function is called on "move" events + * during a drag sequence. + * @property {(function(module:ol/MapBrowserEvent~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] + * 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] + Function handling "up" events. If the function returns `false` then the + * current drag sequence is stopped. + */ + + /** * @classdesc * Base class that calls user-defined functions on `down`, `move` and `up` @@ -50,8 +73,8 @@ const handleMoveEvent = UNDEFINED; * user function is called and returns `false`. * * @constructor - * @param {olx.interaction.PointerOptions=} opt_options Options. - * @extends {ol.interaction.Interaction} + * @param {module:ol/interaction/Pointer~Options=} opt_options Options. + * @extends {module:ol/interaction/Interaction~Interaction} * @api */ const PointerInteraction = function(opt_options) { @@ -63,28 +86,28 @@ const PointerInteraction = function(opt_options) { }); /** - * @type {function(ol.MapBrowserPointerEvent):boolean} + * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean} * @private */ this.handleDownEvent_ = options.handleDownEvent ? options.handleDownEvent : handleDownEvent; /** - * @type {function(ol.MapBrowserPointerEvent)} + * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)} * @private */ this.handleDragEvent_ = options.handleDragEvent ? options.handleDragEvent : handleDragEvent; /** - * @type {function(ol.MapBrowserPointerEvent)} + * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)} * @private */ this.handleMoveEvent_ = options.handleMoveEvent ? options.handleMoveEvent : handleMoveEvent; /** - * @type {function(ol.MapBrowserPointerEvent):boolean} + * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean} * @private */ this.handleUpEvent_ = options.handleUpEvent ? @@ -97,13 +120,13 @@ const PointerInteraction = function(opt_options) { this.handlingDownUpSequence = false; /** - * @type {!Object.} + * @type {!Object.} * @private */ this.trackedPointers_ = {}; /** - * @type {Array.} + * @type {Array.} * @protected */ this.targetPointers = []; @@ -114,7 +137,7 @@ inherits(PointerInteraction, Interaction); /** - * @param {Array.} pointerEvents List of events. + * @param {Array.} pointerEvents List of events. * @return {module:ol~Pixel} Centroid pixel. */ export function centroid(pointerEvents) { @@ -130,7 +153,7 @@ export function centroid(pointerEvents) { /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. * @return {boolean} Whether the event is a pointerdown, pointerdrag * or pointerup event. */ @@ -143,7 +166,7 @@ function isPointerDraggingEvent(mapBrowserEvent) { /** - * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. + * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event. * @private */ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { @@ -171,7 +194,7 @@ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) * detected. * @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event. * @return {boolean} `false` to stop event propagation. - * @this {ol.interaction.Pointer} + * @this {module:ol/interaction/Pointer~Pointer} * @api */ export function handleEvent(mapBrowserEvent) {