@nextgis/ngw-leaflet 1.19.1 → 1.19.4

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/ngw-leaflet; version: 1.19.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.19.4; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -23555,11 +23555,22 @@ class GeoJsonAdapter extends BaseAdapter {
23555
23555
  }
23556
23556
  _updateTooltip(layerDef) {
23557
23557
  const { feature, layer } = layerDef;
23558
- if (feature && layer && feature.properties && this.options.labelField) {
23558
+ const { label, labelField, labelOnHover } = this.options;
23559
+ if (layer) {
23559
23560
  layer.unbindTooltip();
23560
- const message = feature.properties[this.options.labelField];
23561
- if (message !== undefined) {
23562
- const permanent = !this.options.labelOnHover;
23561
+ let message;
23562
+ if (feature.properties && labelField) {
23563
+ message = feature.properties[labelField];
23564
+ }
23565
+ else if (label) {
23566
+ message = label({
23567
+ target: this,
23568
+ ...layerDef,
23569
+ ...createFeaturePositionOptions(feature),
23570
+ });
23571
+ }
23572
+ if (message) {
23573
+ const permanent = !labelOnHover;
23563
23574
  layer.bindTooltip(String(message), { permanent, sticky: false });
23564
23575
  }
23565
23576
  }
@@ -23806,9 +23817,9 @@ class GeoJsonAdapter extends BaseAdapter {
23806
23817
  _addMapListener() {
23807
23818
  const map = this.map;
23808
23819
  if (map) {
23809
- const { labelField, labelOnHover } = this.options;
23820
+ const { label, labelField, labelOnHover } = this.options;
23810
23821
  this._addMapClickListener();
23811
- if (labelField && !labelOnHover) {
23822
+ if ((labelField || label) && !labelOnHover) {
23812
23823
  map.on('zoomend', this.$updateTooltip);
23813
23824
  map.on('moveend', this.$updateTooltip);
23814
23825
  }