UNPKG

ol

Version:

OpenLayers mapping library

156 lines 6.54 kB
/** * @param {Array<PointerEvent>} pointerEvents List of events. * @return {import("../pixel.js").Pixel} Centroid pixel. */ export function centroid(pointerEvents: PointerEvent[]): number[]; export default PointerInteraction; export type Options = { /** * Function handling "down" events. If the function returns `true` then a drag * sequence is started. */ handleDownEvent?: (arg0: import("../MapBrowserPointerEvent.js").default) => boolean; /** * Function handling "drag" events. This function is called on "move" events * during a drag sequence. */ handleDragEvent?: (arg0: import("../MapBrowserPointerEvent.js").default) => any; /** * 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. */ handleEvent?: (arg0: import("../MapBrowserEvent.js").default) => boolean; /** * Function handling "move" events. This function is called on "move" events. * This functions is also called during a drag sequence, so during a drag * sequence both the `handleDragEvent` function and this function are called. * If `handleDownEvent` is defined and it returns true this function will not * be called during a drag sequence. */ handleMoveEvent?: (arg0: import("../MapBrowserPointerEvent.js").default) => any; /** * Function handling "up" events. If the function returns `false` then the * current drag sequence is stopped. */ handleUpEvent?: (arg0: import("../MapBrowserPointerEvent.js").default) => boolean; /** * Should the down event be propagated to other interactions, or should be * stopped? */ stopDown?: (arg0: boolean) => boolean; }; /** * @typedef {Object} Options * @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleDownEvent] * Function handling "down" events. If the function returns `true` then a drag * sequence is started. * @property {function(import("../MapBrowserPointerEvent.js").default)} [handleDragEvent] * Function handling "drag" events. This function is called on "move" events * during a drag sequence. * @property {function(import("../MapBrowserEvent.js").default):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(import("../MapBrowserPointerEvent.js").default)} [handleMoveEvent] * Function handling "move" events. This function is called on "move" events. * This functions is also called during a drag sequence, so during a drag * sequence both the `handleDragEvent` function and this function are called. * If `handleDownEvent` is defined and it returns true this function will not * be called during a drag sequence. * @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleUpEvent] * Function handling "up" events. If the function returns `false` then the * current drag sequence is stopped. * @property {function(boolean):boolean} [stopDown] * Should the down event be propagated to other interactions, or should be * stopped? */ /** * @classdesc * Base class that calls user-defined functions on `down`, `move` and `up` * events. This class also manages "drag sequences". * * When the `handleDownEvent` user function returns `true` a drag sequence is * started. During a drag sequence the `handleDragEvent` user function is * called on `move` events. The drag sequence ends when the `handleUpEvent` * user function is called and returns `false`. * @api */ declare class PointerInteraction extends Interaction { /** * @param {Options=} opt_options Options. */ constructor(opt_options?: Options); /** * Handle pointer down events. * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. * @return {boolean} If the event was consumed. * @protected */ protected handleDownEvent(mapBrowserEvent: import("../MapBrowserPointerEvent.js").default): boolean; /** * Handle pointer drag events. * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. * @protected */ protected handleDragEvent(mapBrowserEvent: import("../MapBrowserPointerEvent.js").default): void; /** * Handle pointer move events. * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. * @protected */ protected handleMoveEvent(mapBrowserEvent: import("../MapBrowserPointerEvent.js").default): void; /** * Handle pointer up events. * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. * @return {boolean} If the event was consumed. * @protected */ protected handleUpEvent(mapBrowserEvent: import("../MapBrowserPointerEvent.js").default): boolean; /** * This function is used to determine if "down" events should be propagated * to other interactions or should be stopped. * @param {boolean} handled Was the event handled by the interaction? * @return {boolean} Should the `down` event be stopped? */ stopDown(handled: boolean): boolean; /** * @type {boolean} * @protected */ protected handlingDownUpSequence: boolean; /** * @type {!Object<string, PointerEvent>} * @private */ private trackedPointers_; /** * @type {Array<PointerEvent>} * @protected */ protected targetPointers: Array<PointerEvent>; /** * Returns the current number of pointers involved in the interaction, * e.g. `2` when two fingers are used. * @return {number} The number of pointers. * @api */ getPointerCount(): number; /** * Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are * detected. * @override * @api */ handleEvent(mapBrowserEvent: any): boolean; /** * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. * @private */ private updateTrackedPointers_; } import Interaction from "./Interaction.js"; //# sourceMappingURL=Pointer.d.ts.map