/** * A function that takes an {@link module:ol/Feature~Feature} or * {@link module:ol/render/Feature~RenderFeature} and an * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be * translated or `false` otherwise. * @typedef {function(Feature, import("../layer/Layer.js").default):boolean} FilterFunction */ /** * @typedef {Object} Options * @property {import("../events/condition.js").Condition} [condition] A function that * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a * boolean to indicate whether that event should be handled. * Default is {@link module:ol/events/condition.always}. * @property {Collection} [features] Features contained in this collection will be able to be translated together. * @property {Array|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 * absent, all visible layers will be considered translatable. * Not used if `features` is provided. * @property {FilterFunction} [filter] A function * that takes an {@link module:ol/Feature~Feature} and an * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be * translated or `false` otherwise. Not used if `features` is provided. * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position * will be checked for features. */ /** * @classdesc * Events emitted by {@link module:ol/interaction/Translate~Translate} instances * are instances of this type. */ export class TranslateEvent extends Event { /** * @param {TranslateEventType} type Type. * @param {Collection} features The features translated. * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate. * @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. */ constructor(type: TranslateEventType, features: Collection, coordinate: import("../coordinate.js").Coordinate, startCoordinate: import("../coordinate.js").Coordinate, mapBrowserEvent: import("../MapBrowserEvent.js").default); /** * The features being translated. * @type {Collection} * @api */ features: Collection; /** * The coordinate of the drag event. * @const * @type {import("../coordinate.js").Coordinate} * @api */ coordinate: import("../coordinate.js").Coordinate; /** * The coordinate of the start position before translation started. * @const * @type {import("../coordinate.js").Coordinate} * @api */ startCoordinate: import("../coordinate.js").Coordinate; /** * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}. * @type {import("../MapBrowserEvent.js").default} * @api */ mapBrowserEvent: import("../MapBrowserEvent.js").default; } export default Translate; /** * A function that takes an {@link module :ol/Feature~Feature} or * {@link module :ol/render/Feature~RenderFeature} and an * {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be * translated or `false` otherwise. */ export type FilterFunction = (arg0: Feature, arg1: import("../layer/Layer.js").default) => boolean; export type Options = { /** * A function that * takes an {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a * boolean to indicate whether that event should be handled. * Default is {@link module :ol/events/condition.always}. */ condition?: import("../events/condition.js").Condition | undefined; /** * Features contained in this collection will be able to be translated together. */ features?: Collection> | undefined; /** * 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 * absent, all visible layers will be considered translatable. * Not used if `features` is provided. */ layers?: import("../layer/Layer.js").default>[] | ((arg0: import("../layer/Layer.js").default) => boolean) | undefined; /** * A function * that takes an {@link module :ol/Feature~Feature} and an * {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be * translated or `false` otherwise. Not used if `features` is provided. */ filter?: FilterFunction | undefined; /** * Hit-detection tolerance. Pixels inside the radius around the given position * will be checked for features. */ hitTolerance?: number | undefined; }; /** * * */ export type TranslateOnSignature = import("../Observable").OnSignature & import("../Observable").OnSignature & import("../Observable").OnSignature<'translateend' | 'translatestart' | 'translating', TranslateEvent, Return> & import("../Observable").CombinedOnSignature; import Event from '../events/Event.js'; import Collection from '../Collection.js'; import Feature from '../Feature.js'; type TranslateEventType = string; declare namespace TranslateEventType { let TRANSLATESTART: string; let TRANSLATING: string; let TRANSLATEEND: string; } /*** * @template Return * @typedef {import("../Observable").OnSignature & * import("../Observable").OnSignature & * import("../Observable").OnSignature<'translateend'|'translatestart'|'translating', TranslateEvent, Return> & * import("../Observable").CombinedOnSignature} TranslateOnSignature */ /** * @classdesc * Interaction for translating (moving) features. * If you want to translate multiple features in a single action (for example, * the collection used by a select interaction), construct the interaction with * the `features` option. * * @fires TranslateEvent * @api */ declare class Translate extends PointerInteraction { /** * @param {Options} [options] Options. */ constructor(options?: Options | undefined); /*** * @type {TranslateOnSignature} */ on: TranslateOnSignature; /*** * @type {TranslateOnSignature} */ once: TranslateOnSignature; /*** * @type {TranslateOnSignature} */ un: TranslateOnSignature; /** * The last position we translated to. * @type {import("../coordinate.js").Coordinate} * @private */ private lastCoordinate_; /** * The start position before translation started. * @type {import("../coordinate.js").Coordinate} * @private */ private startCoordinate_; /** * @type {Collection|null} * @private */ private features_; /** * @private * @type {function(import("../layer/Layer.js").default): boolean} */ private layerFilter_; /** * @private * @type {FilterFunction} */ private filter_; /** * @private * @type {number} */ private hitTolerance_; /** * @private * @type {import("../events/condition.js").Condition} */ private condition_; /** * @type {Feature} * @private */ private lastFeature_; /** * Tests to see if the given coordinates intersects any of our selected * features. * @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection. * @param {import("../Map.js").default} map Map to test the intersection on. * @return {Feature} Returns the feature found at the specified pixel * coordinates. * @private */ private featuresAtPixel_; /** * Returns the Hit-detection tolerance. * @return {number} Hit tolerance in pixels. * @api */ getHitTolerance(): number; /** * Hit-detection tolerance. Pixels inside the radius around the given position * will be checked for features. * @param {number} hitTolerance Hit tolerance in pixels. * @api */ setHitTolerance(hitTolerance: number): void; /** * Remove the interaction from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to * the map here. * @param {import("../Map.js").default} map Map. */ setMap(map: import("../Map.js").default): void; /** * @private */ private handleActiveChanged_; /** * @param {import("../Map.js").default} oldMap Old map. * @private */ private updateState_; } import PointerInteraction from './Pointer.js'; //# sourceMappingURL=Translate.d.ts.map