gis-leaflet-helper 2.1.17 → 2.1.18

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.
@@ -6503,7 +6503,8 @@ const Yr = /* @__PURE__ */ Ua(x), th = /* @__PURE__ */ Xr({
6503
6503
  }
6504
6504
  }, js = x.Control.extend({
6505
6505
  options: {
6506
- position: "bottomleft"
6506
+ position: "bottomleft",
6507
+ coordinateUnit: "decimal"
6507
6508
  },
6508
6509
  initialize(i) {
6509
6510
  x.setOptions(this, i), this.lastTime = +/* @__PURE__ */ new Date(), this.frames = 0, x.Control.prototype.initialize.call(this, this.options);
@@ -6511,15 +6512,30 @@ const Yr = /* @__PURE__ */ Ua(x), th = /* @__PURE__ */ Xr({
6511
6512
  onAdd(i) {
6512
6513
  this.map = i, this.lang = i.lang, this.langDic = tn[this.lang], this._container = x.DomUtil.create("div", `${i.clsPrefix}-statusbar`), this.zoom = i.getZoom();
6513
6514
  const e = i.getCenter();
6514
- return this.lng = e.lng, this.lat = e.lat, this._latlngContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-latlng`, this._container), this._levelContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-level`, this._container), this._fpsContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-fps`, this._container), this._latlngContainer.innerHTML = `<b>${this.langDic.coordinate}:</b>${this.lng.toFixed(6)},${this.lat.toFixed(6)} `, this._levelContainer.innerHTML = `<b>${this.langDic.zoomLevel}:</b>${this.zoom + 1} `, this.initEvt(), this._container;
6515
+ return this.lng = e.lng, this.lat = e.lat, this._latlngContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-latlng`, this._container), this._levelContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-level`, this._container), this._fpsContainer = x.DomUtil.create("div", `${i.clsPrefix}-statusbar-fps`, this._container), this._latlngContainer.innerHTML = `<b>${this.langDic.coordinate}:</b>${this.getCoordinate(this.lng)},${this.getCoordinate(this.lat)} `, this._levelContainer.innerHTML = `<b>${this.langDic.zoomLevel}:</b>${this.zoom + 1} `, this.initEvt(), this._container;
6515
6516
  },
6516
6517
  initEvt() {
6517
6518
  this.map.on("mousemove", (i) => {
6518
- this.lat = i.latlng.lat.toFixed(6), this.lng = i.latlng.lng.toFixed(6), this._latlngContainer.innerHTML = `<b>${this.langDic.coordinate}:</b>${this.lng},${this.lat} `;
6519
+ this.lat = i.latlng.lat, this.lng = i.latlng.lng, this._latlngContainer.innerHTML = `<b>${this.langDic.coordinate}:</b>${this.getCoordinate(this.lng)},${this.getCoordinate(this.lat)} `;
6519
6520
  }), this.map.on("zoomend", () => {
6520
6521
  this.zoom = this.map.getZoom(), this._levelContainer.innerHTML = `<b>${this.langDic.zoomLevel}:</b>${this.zoom + 1} `;
6521
6522
  }), this.calcFPS();
6522
6523
  },
6524
+ getCoordinate(i) {
6525
+ switch (this.options.coordinateUnit) {
6526
+ case "decimal":
6527
+ return i.toFixed(6);
6528
+ case "radian":
6529
+ return (i * Math.PI / 180).toFixed(10);
6530
+ case "degrees":
6531
+ return this._formatDeg(i);
6532
+ }
6533
+ },
6534
+ _formatDeg(i) {
6535
+ const e = parseFloat(i), n = parseInt(e);
6536
+ let o = parseInt((e - n) * 60), r = (e - n) * 3600 - o * 60;
6537
+ return n + "°" + o + "′" + r.toFixed(2) + "″";
6538
+ },
6523
6539
  calcFPS() {
6524
6540
  if (this.frames++, this.frames >= 30) {
6525
6541
  const i = Date.now() - this.lastTime, e = Math.round(1e3 / (i / this.frames));
@@ -11341,9 +11357,9 @@ function wd(i) {
11341
11357
  getCursor() {
11342
11358
  return this.getContainer().style.cursor;
11343
11359
  },
11344
- setCursor(n, o) {
11345
- const r = this.getContainer();
11346
- r.style.cursor = n ? `url(${new URL("./assets/cursor/" + n + (o ? "." + o : ".png"), import.meta.url).href}), auto` : "default";
11360
+ setCursor(n) {
11361
+ const o = this.getContainer();
11362
+ o.style.cursor = n ? typeof n == "string" ? `url(${"./images/cursor/" + n + ".cur"}), auto` : `url(${n}), auto` : "default";
11347
11363
  },
11348
11364
  flyTo(n, o = 0, r = { animate: !1 }) {
11349
11365
  n instanceof x.Marker ? (n = n._latlng, x.Map.prototype.flyTo.call(this, n, o || this.getZoom(), r)) : n instanceof x.Path || n instanceof x.FeatureGroup ? (n = n.getBounds(), x.Map.prototype.flyToBounds.call(this, n, r)) : x.Map.prototype.flyTo.call(this, n, o || this.getZoom(), r);