@nextgis/leaflet-map-adapter 1.15.1 → 1.16.0
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.
- package/README.md +2 -2
- package/lib/leaflet-map-adapter.esm-browser.js +32 -17
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +32 -17
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +2 -2
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +32 -17
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +1 -1
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +7 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 1.16.0; author: NextGIS */
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { Control, DomEvent, GeoJSON, FeatureGroup, DivIcon, Marker, CircleMarker, ImageOverlay as ImageOverlay$1, Util, CRS, Layer, GridLayer, DomUtil, TileLayer as TileLayer$1, Map } from 'leaflet';
|
|
4
4
|
import { defined, debounce as debounce$1 } from '@nextgis/utils';
|
|
@@ -379,12 +379,13 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
379
379
|
this._removeMapListener();
|
|
380
380
|
};
|
|
381
381
|
GeoJsonAdapter.prototype.select = function (findFeatureFun) {
|
|
382
|
-
|
|
382
|
+
this.unselect();
|
|
383
383
|
if (findFeatureFun) {
|
|
384
384
|
var def = this._layers.filter(findFeatureFun);
|
|
385
|
-
def.
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
for (var _i = 0, def_1 = def; _i < def_1.length; _i++) {
|
|
386
|
+
var x = def_1[_i];
|
|
387
|
+
this._selectLayer(x, 'api');
|
|
388
|
+
}
|
|
388
389
|
}
|
|
389
390
|
else if (!this.selected) {
|
|
390
391
|
this.selected = true;
|
|
@@ -797,13 +798,13 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
797
798
|
var _this = this;
|
|
798
799
|
var layer_ = this.layer;
|
|
799
800
|
if (layer_) {
|
|
800
|
-
var
|
|
801
|
+
var def_2 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
|
|
801
802
|
// @ts-ignore
|
|
802
803
|
layer.options.pane = this.pane;
|
|
803
|
-
this._layers.push(
|
|
804
|
+
this._layers.push(def_2);
|
|
804
805
|
var ok = true;
|
|
805
806
|
if (this._filterFun) {
|
|
806
|
-
ok = this._filterFun(
|
|
807
|
+
ok = this._filterFun(def_2);
|
|
807
808
|
}
|
|
808
809
|
if (ok) {
|
|
809
810
|
var _a = this.options, popup_1 = _a.popup, popupOptions_1 = _a.popupOptions, selectable = _a.selectable, interactive = _a.interactive, selectOnHover = _a.selectOnHover;
|
|
@@ -813,10 +814,10 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
813
814
|
if (selectable) {
|
|
814
815
|
if (selectOnHover) {
|
|
815
816
|
layer.on('mouseover', function () {
|
|
816
|
-
_this._selectLayer(
|
|
817
|
+
_this._selectLayer(def_2, 'hover');
|
|
817
818
|
});
|
|
818
819
|
layer.on('mouseout', function () {
|
|
819
|
-
_this._unSelectLayer(
|
|
820
|
+
_this._unSelectLayer(def_2);
|
|
820
821
|
});
|
|
821
822
|
}
|
|
822
823
|
else {
|
|
@@ -883,10 +884,12 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
883
884
|
};
|
|
884
885
|
GeoJsonAdapter.prototype._selectLayer = function (def, type, latlng) {
|
|
885
886
|
var _this = this;
|
|
886
|
-
this.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
887
|
+
var multiselect = this.options.multiselect;
|
|
888
|
+
if (!multiselect) {
|
|
889
|
+
// To unselect layer on another layer click
|
|
890
|
+
this.map._addUnselectCb(function () {
|
|
891
|
+
_this._unSelectLayer(def);
|
|
892
|
+
});
|
|
890
893
|
this._selectedLayers.forEach(function (x) { return _this._unSelectLayer(x); });
|
|
891
894
|
}
|
|
892
895
|
this._selectedLayers.push(def);
|
|
@@ -963,14 +966,26 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
963
966
|
}
|
|
964
967
|
return geoJsonOptions;
|
|
965
968
|
};
|
|
966
|
-
GeoJsonAdapter.prototype.
|
|
969
|
+
GeoJsonAdapter.prototype._addMapClickListener = function () {
|
|
967
970
|
var map = this.map;
|
|
968
971
|
if (map) {
|
|
969
|
-
var
|
|
972
|
+
var unselectOnClick = this.options.unselectOnClick;
|
|
970
973
|
var uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
|
|
971
974
|
if (uoc) {
|
|
972
975
|
map.on('click', this.$unselect);
|
|
973
976
|
}
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
GeoJsonAdapter.prototype._removeMapClickListener = function () {
|
|
980
|
+
this.map.off('zoomend', this.$updateTooltip);
|
|
981
|
+
this.map.off('moveend', this.$updateTooltip);
|
|
982
|
+
this.map.off('click', this.$unselect);
|
|
983
|
+
};
|
|
984
|
+
GeoJsonAdapter.prototype._addMapListener = function () {
|
|
985
|
+
var map = this.map;
|
|
986
|
+
if (map) {
|
|
987
|
+
var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover;
|
|
988
|
+
this._addMapClickListener();
|
|
974
989
|
if (labelField && !labelOnHover) {
|
|
975
990
|
map.on('zoomend', this.$updateTooltip);
|
|
976
991
|
map.on('moveend', this.$updateTooltip);
|
|
@@ -978,9 +993,9 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
978
993
|
}
|
|
979
994
|
};
|
|
980
995
|
GeoJsonAdapter.prototype._removeMapListener = function () {
|
|
996
|
+
this._removeMapClickListener();
|
|
981
997
|
this.map.off('zoomend', this.$updateTooltip);
|
|
982
998
|
this.map.off('moveend', this.$updateTooltip);
|
|
983
|
-
this.map.off('click', this.$unselect);
|
|
984
999
|
};
|
|
985
1000
|
return GeoJsonAdapter;
|
|
986
1001
|
}(BaseAdapter));
|