pwaLUPMIS2/node_modules/.vite/deps/chunk-MSWSBYBR.js
2026-03-04 12:59:40 +01:00

115 lines
2.7 KiB
JavaScript

import {
easeOut,
linear
} from "./chunk-LMC3RO5P.js";
import {
Object_default
} from "./chunk-Q5ZULJHM.js";
// node_modules/ol/interaction/Property.js
var Property_default = {
ACTIVE: "active"
};
// node_modules/ol/interaction/Interaction.js
var Interaction = class extends Object_default {
/**
* @param {InteractionOptions} [options] Options.
*/
constructor(options) {
super();
this.on;
this.once;
this.un;
if (options && options.handleEvent) {
this.handleEvent = options.handleEvent;
}
this.map_ = null;
this.setActive(true);
}
/**
* Return whether the interaction is currently active.
* @return {boolean} `true` if the interaction is active, `false` otherwise.
* @observable
* @api
*/
getActive() {
return (
/** @type {boolean} */
this.get(Property_default.ACTIVE)
);
}
/**
* Get the map associated with this interaction.
* @return {import("../Map.js").default|null} Map.
* @api
*/
getMap() {
return this.map_;
}
/**
* Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event}.
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @api
*/
handleEvent(mapBrowserEvent) {
return true;
}
/**
* Activate or deactivate the interaction.
* @param {boolean} active Active.
* @observable
* @api
*/
setActive(active) {
this.set(Property_default.ACTIVE, active);
}
/**
* 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|null} map Map.
*/
setMap(map) {
this.map_ = map;
}
};
function pan(view, delta, duration) {
const currentCenter = view.getCenterInternal();
if (currentCenter) {
const center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
view.animateInternal({
duration: duration !== void 0 ? duration : 250,
easing: linear,
center: view.getConstrainedCenter(center)
});
}
}
function zoomByDelta(view, delta, anchor, duration) {
const currentZoom = view.getZoom();
if (currentZoom === void 0) {
return;
}
const newZoom = view.getConstrainedZoom(currentZoom + delta);
const newResolution = view.getResolutionForZoom(newZoom);
if (view.getAnimating()) {
view.cancelAnimations();
}
view.animate({
resolution: newResolution,
anchor,
duration: duration !== void 0 ? duration : 250,
easing: easeOut
});
}
var Interaction_default = Interaction;
export {
Property_default,
pan,
zoomByDelta,
Interaction_default
};
//# sourceMappingURL=chunk-MSWSBYBR.js.map