@florasync/leaflet-geokit 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16731,14 +16731,16 @@ class sp {
16731
16731
  n === "move" && ((o = (i = this.activeMoveHandler) == null ? void 0 : i.hasPendingMove) != null && o.call(i)) && ((c = (u = this.activeMoveHandler).cancelMove) == null || c.call(u), this.hideMoveConfirmationUI()), n === "ruler" && this.triggerRulerTool(), n && this.disableActiveToolHandlers();
16732
16732
  }
16733
16733
  resolveLeaflet(n) {
16734
+ var u;
16735
+ const r = (u = Me.default) != null ? u : Me;
16734
16736
  if (!n.useExternalLeaflet)
16735
- return Me;
16737
+ return r;
16736
16738
  if (n.leaflet && qi(n.leaflet))
16737
16739
  return this.logger.debug("leaflet-runtime:external-injected"), n.leaflet;
16738
- const i = globalThis.L;
16739
- return i && qi(i) ? (this.logger.debug("leaflet-runtime:external-global"), i) : (this.logger.warn("leaflet-runtime:external-fallback-bundled", {
16740
+ const o = globalThis.L;
16741
+ return o && qi(o) ? (this.logger.debug("leaflet-runtime:external-global"), o) : (this.logger.warn("leaflet-runtime:external-fallback-bundled", {
16740
16742
  message: "External Leaflet requested but Draw APIs were missing; falling back to bundled Leaflet/Draw"
16741
- }), Me);
16743
+ }), r);
16742
16744
  }
16743
16745
  // ---------------- Lifecycle ----------------
16744
16746
  async init() {
@@ -17012,28 +17014,17 @@ class sp {
17012
17014
  async fitBoundsToData(n = 0.05) {
17013
17015
  if (!this.map) return;
17014
17016
  const r = this.store.bounds();
17015
- if (!r) return;
17016
- const i = r, o = this.L.latLngBounds(i);
17017
- if (n > 0) {
17018
- const u = o.getSouthWest(), c = o.getNorthEast(), f = (c.lat - u.lat) * n, g = (c.lng - u.lng) * n, p = this.L.latLngBounds(
17019
- this.L.latLng(u.lat - f, u.lng - g),
17020
- this.L.latLng(c.lat + f, c.lng + g)
17021
- );
17022
- this.map.fitBounds(p);
17023
- } else
17024
- this.map.fitBounds(o);
17017
+ r && await this.fitBounds(r, n);
17025
17018
  }
17026
17019
  async fitBounds(n, r = 0.05) {
17027
17020
  if (!this.map) return;
17028
- const i = this.L.latLngBounds(n);
17029
- if (r > 0) {
17030
- const o = i.getSouthWest(), u = i.getNorthEast(), c = (u.lat - o.lat) * r, f = (u.lng - o.lng) * r, g = this.L.latLngBounds(
17031
- this.L.latLng(o.lat - c, o.lng - f),
17032
- this.L.latLng(u.lat + c, u.lng + f)
17033
- );
17034
- this.map.fitBounds(g);
17035
- } else
17036
- this.map.fitBounds(i);
17021
+ const [i, o] = n;
17022
+ if (i[0] === o[0] && i[1] === o[1]) {
17023
+ this.map.setView(i, this.map.getZoom());
17024
+ return;
17025
+ }
17026
+ const u = this.L.latLngBounds(n);
17027
+ this.map.fitBounds(r > 0 ? u.pad(r) : u);
17037
17028
  }
17038
17029
  async setView(n, r, i) {
17039
17030
  this.map && this.map.setView([n, r], i != null ? i : this.map.getZoom());
@@ -18783,7 +18774,7 @@ class au extends HTMLElement {
18783
18774
  callbacks: {
18784
18775
  onToolCapabilitiesChanged: () => this._emitToolCapabilities(),
18785
18776
  onReady: (u) => {
18786
- this.dispatchEvent(new CustomEvent(ze.Ready, { detail: u })), this._syncStatusFromController({
18777
+ this._setStatus({ state: "ready", ready: !0, busy: !1 }), this.dispatchEvent(new CustomEvent(ze.Ready, { detail: u })), this._syncStatusFromController({
18787
18778
  state: "ready",
18788
18779
  ready: !0,
18789
18780
  busy: !1,