@florasync/leaflet-geokit 0.11.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.
@@ -5116,14 +5116,16 @@ class Ga {
5116
5116
  t === "move" && ((r = (o = this.activeMoveHandler) == null ? void 0 : o.hasPendingMove) != null && r.call(o)) && ((n = (a = this.activeMoveHandler).cancelMove) == null || n.call(a), this.hideMoveConfirmationUI()), t === "ruler" && this.triggerRulerTool(), t && this.disableActiveToolHandlers();
5117
5117
  }
5118
5118
  resolveLeaflet(t) {
5119
+ var a;
5120
+ const e = (a = P.default) != null ? a : P;
5119
5121
  if (!t.useExternalLeaflet)
5120
- return P;
5122
+ return e;
5121
5123
  if (t.leaflet && Ze(t.leaflet))
5122
5124
  return this.logger.debug("leaflet-runtime:external-injected"), t.leaflet;
5123
- const o = globalThis.L;
5124
- return o && Ze(o) ? (this.logger.debug("leaflet-runtime:external-global"), o) : (this.logger.warn("leaflet-runtime:external-fallback-bundled", {
5125
+ const r = globalThis.L;
5126
+ return r && Ze(r) ? (this.logger.debug("leaflet-runtime:external-global"), r) : (this.logger.warn("leaflet-runtime:external-fallback-bundled", {
5125
5127
  message: "External Leaflet requested but Draw APIs were missing; falling back to bundled Leaflet/Draw"
5126
- }), P);
5128
+ }), e);
5127
5129
  }
5128
5130
  // ---------------- Lifecycle ----------------
5129
5131
  async init() {
@@ -5397,28 +5399,17 @@ class Ga {
5397
5399
  async fitBoundsToData(t = 0.05) {
5398
5400
  if (!this.map) return;
5399
5401
  const e = this.store.bounds();
5400
- if (!e) return;
5401
- const o = e, r = this.L.latLngBounds(o);
5402
- if (t > 0) {
5403
- const a = r.getSouthWest(), n = r.getNorthEast(), s = (n.lat - a.lat) * t, l = (n.lng - a.lng) * t, c = this.L.latLngBounds(
5404
- this.L.latLng(a.lat - s, a.lng - l),
5405
- this.L.latLng(n.lat + s, n.lng + l)
5406
- );
5407
- this.map.fitBounds(c);
5408
- } else
5409
- this.map.fitBounds(r);
5402
+ e && await this.fitBounds(e, t);
5410
5403
  }
5411
5404
  async fitBounds(t, e = 0.05) {
5412
5405
  if (!this.map) return;
5413
- const o = this.L.latLngBounds(t);
5414
- if (e > 0) {
5415
- const r = o.getSouthWest(), a = o.getNorthEast(), n = (a.lat - r.lat) * e, s = (a.lng - r.lng) * e, l = this.L.latLngBounds(
5416
- this.L.latLng(r.lat - n, r.lng - s),
5417
- this.L.latLng(a.lat + n, a.lng + s)
5418
- );
5419
- this.map.fitBounds(l);
5420
- } else
5421
- this.map.fitBounds(o);
5406
+ const [o, r] = t;
5407
+ if (o[0] === r[0] && o[1] === r[1]) {
5408
+ this.map.setView(o, this.map.getZoom());
5409
+ return;
5410
+ }
5411
+ const a = this.L.latLngBounds(t);
5412
+ this.map.fitBounds(e > 0 ? a.pad(e) : a);
5422
5413
  }
5423
5414
  async setView(t, e, o) {
5424
5415
  this.map && this.map.setView([t, e], o != null ? o : this.map.getZoom());
@@ -8547,4 +8538,4 @@ export {
8547
8538
  Rt as normalizeGeoJSON,
8548
8539
  ft as validateGeoJSON
8549
8540
  };
8550
- //# sourceMappingURL=index-D9ScFTVe.js.map
8541
+ //# sourceMappingURL=index-CFFA4RWo.js.map