@nextgis/leaflet-map-adapter 4.1.0 → 4.1.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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 4.1.0; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 4.1.1; author: NextGIS */
2
2
  function getElement(el) {
3
3
  if (typeof el === "string") {
4
4
  let el_ = document.getElementById(el);
@@ -15468,6 +15468,8 @@ function filterGeometries(data, type) {
15468
15468
  _data.geometries = _data.geometries.filter(
15469
15469
  (g) => geometryFilter(g.type, type)
15470
15470
  );
15471
+ } else if (!geometryFilter(data.type, type)) {
15472
+ return false;
15471
15473
  }
15472
15474
  return data;
15473
15475
  }
@@ -16019,6 +16021,9 @@ class GeoJsonAdapter extends BaseAdapter {
16019
16021
  }
16020
16022
  setData(data) {
16021
16023
  this.clearLayer();
16024
+ if (!this.options.type) {
16025
+ this.type = void 0;
16026
+ }
16022
16027
  this.addData(data);
16023
16028
  }
16024
16029
  addData(data) {
@@ -16033,15 +16038,20 @@ class GeoJsonAdapter extends BaseAdapter {
16033
16038
  } else {
16034
16039
  type = options.type;
16035
16040
  }
16041
+ if (!type) {
16042
+ return;
16043
+ }
16036
16044
  if (this.type && this.type !== type) {
16037
16045
  console.warn("no other data type than layer can be added");
16038
16046
  return;
16039
16047
  }
16040
16048
  this.type = type;
16041
16049
  data = filterGeometries(data, type);
16042
- if (data) {
16043
- geoJsonOptions = this._getGeoJsonOptions(options, type);
16050
+ if (!data) {
16051
+ console.warn("no other data type than layer can be added");
16052
+ return;
16044
16053
  }
16054
+ geoJsonOptions = this._getGeoJsonOptions(options, type);
16045
16055
  }
16046
16056
  new leafletSrcExports.GeoJSON(data || void 0, geoJsonOptions);
16047
16057
  }
@@ -17513,10 +17523,10 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
17513
17523
  }
17514
17524
  const stop2 = () => {
17515
17525
  if (locationfound !== void 0) {
17516
- map.off("locationfound", locationFound);
17526
+ map.off("locationfound", locationFound, this);
17517
17527
  }
17518
17528
  if (locationerror) {
17519
- map.off("locationerror", locationerror);
17529
+ map.off("locationerror", locationerror, this);
17520
17530
  }
17521
17531
  };
17522
17532
  return { stop: stop2 };