No olx and ol types for ol/interaction/Pointer

This commit is contained in:
ahocevar
2018-03-16 16:47:04 +01:00
parent 89f6d74696
commit c53a13fc26
3 changed files with 43 additions and 96 deletions

View File

@@ -46,64 +46,6 @@ olx.interaction.TranslateOptions.prototype.layers;
olx.interaction.TranslateOptions.prototype.hitTolerance; 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), * @typedef {{addCondition: (ol.EventsConditionType|undefined),
* condition: (ol.EventsConditionType|undefined), * condition: (ol.EventsConditionType|undefined),

View File

@@ -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 * @typedef {Object} interaction_SelectOptions
* @property {ol.EventsConditionType|undefined} addCondition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean * @property {ol.EventsConditionType|undefined} addCondition A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean

View File

@@ -10,35 +10,58 @@ import {getValues} from '../obj.js';
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {ol.interaction.Pointer} * @this {module:ol/interaction/Pointer~Pointer}
*/ */
const handleDragEvent = UNDEFINED; const handleDragEvent = UNDEFINED;
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Capture dragging. * @return {boolean} Capture dragging.
* @this {ol.interaction.Pointer} * @this {module:ol/interaction/Pointer~Pointer}
*/ */
const handleUpEvent = FALSE; const handleUpEvent = FALSE;
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @return {boolean} Capture dragging. * @return {boolean} Capture dragging.
* @this {ol.interaction.Pointer} * @this {module:ol/interaction/Pointer~Pointer}
*/ */
const handleDownEvent = FALSE; const handleDownEvent = FALSE;
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @this {ol.interaction.Pointer} * @this {module:ol/interaction/Pointer~Pointer}
*/ */
const handleMoveEvent = UNDEFINED; 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 * @classdesc
* Base class that calls user-defined functions on `down`, `move` and `up` * 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`. * user function is called and returns `false`.
* *
* @constructor * @constructor
* @param {olx.interaction.PointerOptions=} opt_options Options. * @param {module:ol/interaction/Pointer~Options=} opt_options Options.
* @extends {ol.interaction.Interaction} * @extends {module:ol/interaction/Interaction~Interaction}
* @api * @api
*/ */
const PointerInteraction = function(opt_options) { 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 * @private
*/ */
this.handleDownEvent_ = options.handleDownEvent ? this.handleDownEvent_ = options.handleDownEvent ?
options.handleDownEvent : handleDownEvent; options.handleDownEvent : handleDownEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent)} * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)}
* @private * @private
*/ */
this.handleDragEvent_ = options.handleDragEvent ? this.handleDragEvent_ = options.handleDragEvent ?
options.handleDragEvent : handleDragEvent; options.handleDragEvent : handleDragEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent)} * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent)}
* @private * @private
*/ */
this.handleMoveEvent_ = options.handleMoveEvent ? this.handleMoveEvent_ = options.handleMoveEvent ?
options.handleMoveEvent : handleMoveEvent; options.handleMoveEvent : handleMoveEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent):boolean} * @type {function(module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent):boolean}
* @private * @private
*/ */
this.handleUpEvent_ = options.handleUpEvent ? this.handleUpEvent_ = options.handleUpEvent ?
@@ -97,13 +120,13 @@ const PointerInteraction = function(opt_options) {
this.handlingDownUpSequence = false; this.handlingDownUpSequence = false;
/** /**
* @type {!Object.<string, ol.pointer.PointerEvent>} * @type {!Object.<string, module:ol/pointer/PointerEvent~PointerEvent>}
* @private * @private
*/ */
this.trackedPointers_ = {}; this.trackedPointers_ = {};
/** /**
* @type {Array.<ol.pointer.PointerEvent>} * @type {Array.<module:ol/pointer/PointerEvent~PointerEvent>}
* @protected * @protected
*/ */
this.targetPointers = []; this.targetPointers = [];
@@ -114,7 +137,7 @@ inherits(PointerInteraction, Interaction);
/** /**
* @param {Array.<ol.pointer.PointerEvent>} pointerEvents List of events. * @param {Array.<module:ol/pointer/PointerEvent~PointerEvent>} pointerEvents List of events.
* @return {module:ol~Pixel} Centroid pixel. * @return {module:ol~Pixel} Centroid pixel.
*/ */
export function centroid(pointerEvents) { 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 * @return {boolean} Whether the event is a pointerdown, pointerdrag
* or pointerup event. * or pointerup event.
*/ */
@@ -143,7 +166,7 @@ function isPointerDraggingEvent(mapBrowserEvent) {
/** /**
* @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @param {module:ol/MapBrowserPointerEvent~MapBrowserPointerEvent} mapBrowserEvent Event.
* @private * @private
*/ */
PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) { PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) {
@@ -171,7 +194,7 @@ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent)
* detected. * detected.
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event. * @param {module:ol/MapBrowserEvent~MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation. * @return {boolean} `false` to stop event propagation.
* @this {ol.interaction.Pointer} * @this {module:ol/interaction/Pointer~Pointer}
* @api * @api
*/ */
export function handleEvent(mapBrowserEvent) { export function handleEvent(mapBrowserEvent) {