import { MapEventType_default } from "./chunk-BHVDQB66.js"; import { Object_default } from "./chunk-H47PV7W6.js"; import { VOID, listen, unlistenByKey } from "./chunk-KJXIHBKT.js"; // node_modules/ol/pointer/EventType.js var EventType_default = { POINTERMOVE: "pointermove", POINTERDOWN: "pointerdown", POINTERUP: "pointerup", POINTEROVER: "pointerover", POINTEROUT: "pointerout", POINTERENTER: "pointerenter", POINTERLEAVE: "pointerleave", POINTERCANCEL: "pointercancel" }; // node_modules/ol/control/Control.js var Control = class extends Object_default { /** * @param {Options} options Control options. */ constructor(options) { super(); const element = options.element; if (element && !options.target && !element.style.pointerEvents) { element.style.pointerEvents = "auto"; } this.element = element ? element : null; this.target_ = null; this.map_ = null; this.listenerKeys = []; if (options.render) { this.render = options.render; } if (options.target) { this.setTarget(options.target); } } /** * Clean up. * @override */ disposeInternal() { var _a; (_a = this.element) == null ? void 0 : _a.remove(); super.disposeInternal(); } /** * Get the map associated with this control. * @return {import("../Map.js").default|null} Map. * @api */ getMap() { return this.map_; } /** * Remove the control from its current map and attach it to the new map. * Pass `null` to just remove the control from the current map. * Subclasses may set up event handlers to get notified about changes to * the map here. * @param {import("../Map.js").default|null} map Map. * @api */ setMap(map) { var _a; if (this.map_) { (_a = this.element) == null ? void 0 : _a.remove(); } for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) { unlistenByKey(this.listenerKeys[i]); } this.listenerKeys.length = 0; this.map_ = map; if (map) { const target = this.target_ ?? map.getOverlayContainerStopEvent(); if (this.element) { target.appendChild(this.element); } if (this.render !== VOID) { this.listenerKeys.push( listen(map, MapEventType_default.POSTRENDER, this.render, this) ); } map.render(); } } /** * Renders the control. * @param {import("../MapEvent.js").default} mapEvent Map event. * @api */ render(mapEvent) { } /** * This function is used to set a target element for the control. It has no * effect if it is called after the control has been added to the map (i.e. * after `setMap` is called on the control). If no `target` is set in the * options passed to the control constructor and if `setTarget` is not called * then the control is added to the map's overlay container. * @param {HTMLElement|string} target Target. * @api */ setTarget(target) { this.target_ = typeof target === "string" ? document.getElementById(target) : target; } }; var Control_default = Control; export { EventType_default, Control_default }; //# sourceMappingURL=chunk-LXWL6YOU.js.map