@nextgis/leaflet-map-adapter 1.9.0 → 1.10.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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 1.9.0; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 1.10.0; author: NextGIS */
2
2
  var LeafletMapAdapter = (function () {
3
3
  'use strict';
4
4
 
@@ -14664,6 +14664,9 @@ var LeafletMapAdapter = (function () {
14664
14664
  if (options.bar) {
14665
14665
  element.classList.add('leaflet-bar');
14666
14666
  }
14667
+ if (options.addClass) {
14668
+ element.classList.add(options.addClass);
14669
+ }
14667
14670
  if (!options.margin && !options.bar) {
14668
14671
  element.style.marginBottom = '0px';
14669
14672
  element.style.marginTop = '0px';
@@ -15424,13 +15427,13 @@ var LeafletMapAdapter = (function () {
15424
15427
  };
15425
15428
  GeoJsonAdapter.prototype._handleMouseEvents = function (layer) {
15426
15429
  var _this = this;
15427
- var isSelected = function (l) { return _this._selectedLayers.indexOf(l) !== -1; };
15428
15430
  var _a = this.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
15429
15431
  // TODO: remove backward compatibility for onLayerClick
15430
15432
  var onClick_ = onClick || onLayerClick;
15431
15433
  if (onClick_) {
15432
15434
  layer.on('click', function (e) {
15433
- onClick_(__assign({ selected: isSelected(e.target) }, _this._createMouseEvent(e)));
15435
+ var selected = !!_this._getSelected(layer);
15436
+ onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
15434
15437
  }, this);
15435
15438
  }
15436
15439
  if (onMouseOut) {
@@ -15450,12 +15453,15 @@ var LeafletMapAdapter = (function () {
15450
15453
  source: source,
15451
15454
  });
15452
15455
  };
15456
+ GeoJsonAdapter.prototype._getSelected = function (layer) {
15457
+ return this._selectedLayers.find(function (x) { return x.layer === layer; });
15458
+ };
15453
15459
  GeoJsonAdapter.prototype._selectOnLayerClick = function (e) {
15454
15460
  leafletSrc.exports.DomEvent.stopPropagation(e);
15455
15461
  var layer = e.target;
15456
15462
  var feature = layer.feature;
15457
15463
  var def = __assign({ target: this, layer: layer, feature: feature }, createFeaturePositionOptions(feature));
15458
- var isSelected = this._selectedLayers.find(function (x) { return x.layer === layer; });
15464
+ var isSelected = this._getSelected(layer);
15459
15465
  if (isSelected) {
15460
15466
  if (this.options && this.options.unselectOnSecondClick) {
15461
15467
  this._unSelectLayer(isSelected);