@nextgis/ngw-leaflet 1.18.3 → 1.18.6

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.18.3; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.6; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.3; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.6; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -19584,10 +19584,11 @@ var NgwLeaflet = (function () {
19584
19584
  */
19585
19585
  NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
19586
19586
  var _this = this;
19587
- var _a;
19587
+ var _a, _b;
19588
19588
  if (params_ === void 0) { params_ = {}; }
19589
19589
  if (requestOptions === void 0) { requestOptions = {}; }
19590
19590
  var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
19591
+ params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
19591
19592
  var params = objectRemoveEmpty(params_);
19592
19593
  var makeApiRequest = function () {
19593
19594
  return apiRequest({ name: name, params: params, requestOptions: requestOptions, connector: _this });
@@ -19599,7 +19600,7 @@ var NgwLeaflet = (function () {
19599
19600
  withCredentials: withCredentials,
19600
19601
  responseType: responseType,
19601
19602
  baseUrl: this.options.baseUrl,
19602
- userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
19603
+ userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
19603
19604
  })));
19604
19605
  }
19605
19606
  return makeApiRequest();
@@ -22992,11 +22993,12 @@ var NgwLeaflet = (function () {
22992
22993
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
22993
22994
  asterisk: '<path d="m7.59 12v-3.27l2.83 1.64 1.58-2.74-2.85-1.64 2.83-1.64-1.56-2.74-2.83 1.64v-3.24h-3.17v3.24l-2.85-1.64-1.57 2.74 2.84 1.64-2.84 1.64 1.57 2.74 2.85-1.64v3.27z"/>',
22994
22995
  };
22996
+ var VIEW_BOX = 12;
22995
22997
  var STROKE = 0.8;
22996
- function generateSvg(width, height, stroke, content) {
22997
- if (stroke === void 0) { stroke = 0; }
22998
+ function generateSvg(_a) {
22999
+ var width = _a.width, height = _a.height, _b = _a.stroke, stroke = _b === void 0 ? 0 : _b, content = _a.content;
22998
23000
  var s = stroke / 2;
22999
- var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(width + stroke, " ").concat(height + stroke, "\"\n >").concat(content, "</svg>");
23001
+ var svg = "<svg\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(width, "\"\n height=\"").concat(height, "\"\n viewBox=\"-").concat(s, " -").concat(s, " ").concat(VIEW_BOX + stroke, " ").concat(VIEW_BOX + stroke, "\"\n >").concat(content, "</svg>");
23000
23002
  return svg;
23001
23003
  }
23002
23004
  function insertSvg(svg) {
@@ -23004,37 +23006,46 @@ var NgwLeaflet = (function () {
23004
23006
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
23005
23007
  return oDOM.documentElement;
23006
23008
  }
23009
+ /**
23010
+ * Retrieves an icon with the provided options.
23011
+ * @function
23012
+ * @param {IconOptions} [opt={}] - Options for the icon.
23013
+ * @returns {IconPaint} Icon paint object.
23014
+ */
23007
23015
  function getIcon(opt) {
23008
- var _a, _b, _c, _d, _e;
23016
+ var _a, _b, _c, _d, _e, _f;
23009
23017
  if (opt === void 0) { opt = {}; }
23010
- // default values
23018
+ // Default values
23011
23019
  var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
23012
23020
  var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
23013
23021
  var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
23014
- var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
23022
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
23015
23023
  var rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
23016
- var anchor = size / 2;
23017
- var defSize = 12;
23024
+ var anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
23018
23025
  var stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
23019
- var scale = size / defSize;
23020
23026
  var pathAlias = opt.p || svgPath[shape] || 'circle';
23021
23027
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
23022
- var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
23023
- var fistChild = svg.firstChild;
23024
- var scaledAnchor = defSize / 2;
23025
- var transform = "scale(".concat(scale, ") rotate(").concat(rotate, ", ").concat(scaledAnchor, ", ").concat(scaledAnchor, ")");
23026
- fistChild.setAttribute('fill', color);
23028
+ var svg = insertSvg(opt.svg ||
23029
+ generateSvg({
23030
+ width: size,
23031
+ height: size,
23032
+ stroke: stroke,
23033
+ content: path,
23034
+ }));
23035
+ svg.setAttribute('width', String(size));
23036
+ svg.setAttribute('height', String(size));
23037
+ svg.setAttribute('fill', color);
23027
23038
  if (stroke) {
23028
- fistChild.setAttribute('stroke', strokeColor);
23029
- fistChild.setAttribute('stroke-width', String(stroke));
23039
+ svg.setAttribute('stroke', strokeColor);
23040
+ svg.setAttribute('stroke-width', String(stroke));
23030
23041
  }
23031
- fistChild.setAttribute('transform', transform);
23032
23042
  var s = new XMLSerializer();
23033
23043
  return {
23034
23044
  type: 'icon',
23035
23045
  iconSize: [size, size],
23036
- iconAnchor: [anchor, anchor],
23046
+ iconAnchor: anchor,
23037
23047
  html: s.serializeToString(svg),
23048
+ rotate: rotate,
23038
23049
  svg: svg,
23039
23050
  };
23040
23051
  }
@@ -23944,14 +23955,6 @@ var NgwLeaflet = (function () {
23944
23955
  };
23945
23956
  }
23946
23957
 
23947
- function createMouseEvent(_a) {
23948
- var layer = _a.layer, source = _a.source;
23949
- var layer_ = source.target;
23950
- var feature = layer_.feature;
23951
- var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
23952
- return opt;
23953
- }
23954
-
23955
23958
  function findMostFrequentGeomType(arr) {
23956
23959
  var counts = {};
23957
23960
  for (var fry = 0; fry < arr.length; fry++) {
@@ -24007,6 +24010,195 @@ var NgwLeaflet = (function () {
24007
24010
  return BaseAdapter;
24008
24011
  }());
24009
24012
 
24013
+ function createMouseEvent(_a) {
24014
+ var layer = _a.layer, source = _a.source;
24015
+ var layer_ = source.target;
24016
+ var feature = layer_.feature;
24017
+ var opt = __assign({ layer: layer, feature: feature, event: convertMapClickEvent(source), source: source }, createFeaturePositionOptions(feature));
24018
+ return opt;
24019
+ }
24020
+
24021
+ var GeoJsonEvents = /** @class */ (function () {
24022
+ function GeoJsonEvents(layer) {
24023
+ this.layer = layer;
24024
+ }
24025
+ GeoJsonEvents.prototype.handleMouseEvents = function (layer) {
24026
+ var _this = this;
24027
+ var _a = this.layer.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
24028
+ // TODO: remove backward compatibility for onLayerClick
24029
+ var onClick_ = onClick || onLayerClick;
24030
+ if (onClick_) {
24031
+ this._onclick = function (e) {
24032
+ var selected = !!_this.layer._getSelected(layer);
24033
+ onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
24034
+ };
24035
+ layer.on('click', this._onclick, this);
24036
+ }
24037
+ if (onMouseOut) {
24038
+ this._mouseout = function (e) {
24039
+ onMouseOut(_this._createMouseEvent(e));
24040
+ };
24041
+ layer.on('mouseout', this._mouseout, this);
24042
+ }
24043
+ if (onMouseOver) {
24044
+ this._mouseover = function (e) {
24045
+ onMouseOver(_this._createMouseEvent(e));
24046
+ };
24047
+ layer.on('mouseover', this._mouseover, this);
24048
+ }
24049
+ };
24050
+ GeoJsonEvents.prototype.stopMouseEvents = function (layer) {
24051
+ if (this._mouseover) {
24052
+ layer.off('mouseover', this._mouseover, this);
24053
+ }
24054
+ if (this._mouseout) {
24055
+ layer.off('mouseout', this._mouseout, this);
24056
+ }
24057
+ if (this._onclick) {
24058
+ layer.off('click', this._onclick, this);
24059
+ }
24060
+ };
24061
+ GeoJsonEvents.prototype._createMouseEvent = function (source) {
24062
+ return createMouseEvent({
24063
+ layer: this.layer,
24064
+ source: source,
24065
+ });
24066
+ };
24067
+ return GeoJsonEvents;
24068
+ }());
24069
+
24070
+ var GeoJsonPaint = /** @class */ (function () {
24071
+ function GeoJsonPaint(layer) {
24072
+ this.layer = layer;
24073
+ }
24074
+ GeoJsonPaint.prototype.setPaintEachLayer = function (paint) {
24075
+ var _this = this;
24076
+ this.layer._layers.forEach(function (layerDef) {
24077
+ _this.setPaint(layerDef, paint);
24078
+ });
24079
+ };
24080
+ GeoJsonPaint.prototype.setPaint = function (layerDef, paint) {
24081
+ var style = undefined;
24082
+ var layer = layerDef.layer, feature = layerDef.feature;
24083
+ if (layer && feature) {
24084
+ if (isPaintCallback(paint)) {
24085
+ style = paint(feature);
24086
+ }
24087
+ else if (isPaint(paint)) {
24088
+ style = paint;
24089
+ }
24090
+ if (style) {
24091
+ if (this.layer.type === 'point' && style.type === 'icon') {
24092
+ var marker_1 = layer;
24093
+ var divIcon_1 = this._createDivIcon(style);
24094
+ setTimeout(function () {
24095
+ marker_1.setIcon(divIcon_1);
24096
+ }, 10);
24097
+ }
24098
+ else if ('setStyle' in layer) {
24099
+ layer.setStyle(this.preparePaint(style));
24100
+ }
24101
+ }
24102
+ }
24103
+ };
24104
+ GeoJsonPaint.prototype.preparePaint = function (paint) {
24105
+ if (paint.type !== 'get-paint') {
24106
+ var paintAliases = [
24107
+ ['color', 'strokeColor'],
24108
+ ['opacity', 'strokeOpacity'],
24109
+ ['stroke', 'stroke'],
24110
+ ['fillColor', 'fillColor'],
24111
+ ['fillOpacity', 'fillOpacity'],
24112
+ ['fill', 'fill'],
24113
+ ['weight', 'weight'],
24114
+ ];
24115
+ var aliases = this.layer.type === 'line'
24116
+ ? [
24117
+ ['color', 'strokeColor'],
24118
+ ['opacity', 'strokeOpacity'],
24119
+ ['weight', 'weight'],
24120
+ ]
24121
+ : paintAliases;
24122
+ var readyPaint = {};
24123
+ if ('radius' in paint && typeof paint.radius === 'number') {
24124
+ readyPaint.radius = paint.radius;
24125
+ }
24126
+ for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
24127
+ var _a = aliases_1[_i], to = _a[0], from = _a[1];
24128
+ var opacity = this.layer.options.opacity;
24129
+ var paintProp = paint[from];
24130
+ if (defined(opacity) && from.toLowerCase().indexOf('opacity') !== -1) {
24131
+ paintProp = Number(paintProp) * opacity;
24132
+ }
24133
+ if (paintProp !== undefined) {
24134
+ Object.defineProperty(readyPaint, to, {
24135
+ enumerable: true,
24136
+ value: paintProp,
24137
+ });
24138
+ }
24139
+ }
24140
+ return readyPaint;
24141
+ }
24142
+ return PAINT;
24143
+ };
24144
+ GeoJsonPaint.prototype._createDivIcon = function (icon) {
24145
+ var html = icon.html, rotate = icon.rotate, className = icon.className, toLIconOpt = __rest(icon, ["html", "rotate", "className"]);
24146
+ var element = document.createElement('div');
24147
+ if (className) {
24148
+ element.className = className;
24149
+ }
24150
+ if (rotate) {
24151
+ element.style.transform = "rotateZ(".concat(rotate, "deg)");
24152
+ }
24153
+ if (html) {
24154
+ element.innerHTML = html;
24155
+ }
24156
+ var divIcon = new leafletSrc.exports.DivIcon(__assign(__assign({ className: '' }, toLIconOpt), { html: element }));
24157
+ return divIcon;
24158
+ };
24159
+ GeoJsonPaint.prototype.createPaintToLayer = function (icon) {
24160
+ var _this = this;
24161
+ if (icon && icon.type) {
24162
+ if (icon.type === 'icon') {
24163
+ var iconClassName = icon.className;
24164
+ var html = icon.html;
24165
+ if (iconClassName || html) {
24166
+ return function (_, latlng) {
24167
+ var divIcon = _this._createDivIcon(icon);
24168
+ return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
24169
+ };
24170
+ }
24171
+ }
24172
+ else if (icon.type === 'pin') {
24173
+ return function (_, latlng) {
24174
+ return new leafletSrc.exports.Marker(latlng);
24175
+ };
24176
+ }
24177
+ }
24178
+ return function (_, latlng) {
24179
+ var p = PAINT;
24180
+ return new leafletSrc.exports.CircleMarker(latlng, _this.preparePaint(__assign(__assign({}, p), icon)));
24181
+ };
24182
+ };
24183
+ GeoJsonPaint.prototype.createPaintOptions = function (paint) {
24184
+ var geoJsonOptions = {};
24185
+ var newPaint = this.preparePaint(paint);
24186
+ if (paint) {
24187
+ geoJsonOptions.style = function () {
24188
+ return newPaint;
24189
+ };
24190
+ }
24191
+ if (this.layer.type === 'point') {
24192
+ geoJsonOptions.pointToLayer = this.createPaintToLayer(paint);
24193
+ }
24194
+ else if (this.layer.type === 'line') {
24195
+ newPaint.stroke = true;
24196
+ }
24197
+ return geoJsonOptions;
24198
+ };
24199
+ return GeoJsonPaint;
24200
+ }());
24201
+
24010
24202
  var GeoJsonAdapter = /** @class */ (function (_super) {
24011
24203
  __extends(GeoJsonAdapter, _super);
24012
24204
  function GeoJsonAdapter(map, options) {
@@ -24022,6 +24214,8 @@ var NgwLeaflet = (function () {
24022
24214
  _this.$unselect = function () {
24023
24215
  _this.unselect();
24024
24216
  };
24217
+ _this._events = new GeoJsonEvents(_this);
24218
+ _this._paint = new GeoJsonPaint(_this);
24025
24219
  return _this;
24026
24220
  }
24027
24221
  GeoJsonAdapter.prototype.addLayer = function (options) {
@@ -24051,7 +24245,7 @@ var NgwLeaflet = (function () {
24051
24245
  else if (!this.selected) {
24052
24246
  this.selected = true;
24053
24247
  if (this.selectedPaint) {
24054
- this._setPaintEachLayer(this.selectedPaint);
24248
+ this._paint.setPaintEachLayer(this.selectedPaint);
24055
24249
  }
24056
24250
  }
24057
24251
  };
@@ -24069,7 +24263,7 @@ var NgwLeaflet = (function () {
24069
24263
  this._removePopup(p[0]);
24070
24264
  }
24071
24265
  if (this.paint) {
24072
- this._setPaintEachLayer(this.paint);
24266
+ this._paint.setPaintEachLayer(this.paint);
24073
24267
  }
24074
24268
  this._selectedLayers.length = 0;
24075
24269
  this.selected = false;
@@ -24230,7 +24424,7 @@ var NgwLeaflet = (function () {
24230
24424
  this.paint = paint;
24231
24425
  for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
24232
24426
  var l = _a[_i];
24233
- this._setPaint(l, paint);
24427
+ this._paint.setPaint(l, paint);
24234
24428
  }
24235
24429
  }
24236
24430
  };
@@ -24239,7 +24433,7 @@ var NgwLeaflet = (function () {
24239
24433
  this.selectedPaint = paint;
24240
24434
  for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
24241
24435
  var l = _a[_i];
24242
- this._setPaint(l, paint);
24436
+ this._paint.setPaint(l, paint);
24243
24437
  }
24244
24438
  }
24245
24439
  };
@@ -24247,16 +24441,19 @@ var NgwLeaflet = (function () {
24247
24441
  this.paint = __assign(__assign({}, this.paint), paint);
24248
24442
  for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
24249
24443
  var l = _a[_i];
24250
- this._setPaint(l, this.paint);
24444
+ this._paint.setPaint(l, this.paint);
24251
24445
  }
24252
24446
  };
24253
24447
  GeoJsonAdapter.prototype.updateSelectedPaint = function (paint) {
24254
24448
  this.selectedPaint = __assign(__assign({}, this.selectedPaint), paint);
24255
24449
  for (var _i = 0, _a = this._selectedLayers; _i < _a.length; _i++) {
24256
24450
  var l = _a[_i];
24257
- this._setPaint(l, this.selectedPaint);
24451
+ this._paint.setPaint(l, this.selectedPaint);
24258
24452
  }
24259
24453
  };
24454
+ GeoJsonAdapter.prototype._getSelected = function (layer) {
24455
+ return this._selectedLayers.find(function (x) { return x.layer === layer; });
24456
+ };
24260
24457
  GeoJsonAdapter.prototype._updateTooltip = function (layerDef) {
24261
24458
  var feature = layerDef.feature, layer = layerDef.layer;
24262
24459
  if (feature && layer && feature.properties && this.options.labelField) {
@@ -24348,79 +24545,6 @@ var NgwLeaflet = (function () {
24348
24545
  }
24349
24546
  }
24350
24547
  };
24351
- GeoJsonAdapter.prototype._setPaintEachLayer = function (paint) {
24352
- var _this = this;
24353
- this._layers.forEach(function (l) {
24354
- _this._setPaint(l, paint);
24355
- });
24356
- };
24357
- GeoJsonAdapter.prototype._setPaint = function (def, paint) {
24358
- var style = undefined;
24359
- var layer = def.layer, feature = def.feature;
24360
- if (layer && feature) {
24361
- if (isPaintCallback(paint)) {
24362
- style = paint(feature);
24363
- }
24364
- else if (isPaint(paint)) {
24365
- style = paint;
24366
- }
24367
- if (style) {
24368
- if (this.type === 'point' && style.type === 'icon') {
24369
- var marker = layer;
24370
- var divIcon = this._createDivIcon(style);
24371
- marker.setIcon(divIcon);
24372
- }
24373
- else if ('setStyle' in layer) {
24374
- layer.setStyle(this._preparePaint(style));
24375
- }
24376
- }
24377
- }
24378
- };
24379
- GeoJsonAdapter.prototype._preparePaint = function (paint) {
24380
- if (paint.type !== 'get-paint') {
24381
- // const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
24382
- // if (path.opacity) {
24383
- // path.fillOpacity = path.opacity;
24384
- // }
24385
- var paintAliases = [
24386
- // ['color', 'color'],
24387
- ['color', 'strokeColor'],
24388
- ['opacity', 'strokeOpacity'],
24389
- ['stroke', 'stroke'],
24390
- ['fillColor', 'fillColor'],
24391
- ['fillOpacity', 'fillOpacity'],
24392
- ['fill', 'fill'],
24393
- ['weight', 'weight'],
24394
- ];
24395
- var aliases = this.type === 'line'
24396
- ? [
24397
- ['color', 'strokeColor'],
24398
- ['opacity', 'strokeOpacity'],
24399
- ['weight', 'weight'],
24400
- ]
24401
- : paintAliases;
24402
- var readyPaint = {};
24403
- if ('radius' in paint && typeof paint.radius === 'number') {
24404
- readyPaint.radius = paint.radius;
24405
- }
24406
- for (var _i = 0, aliases_1 = aliases; _i < aliases_1.length; _i++) {
24407
- var _a = aliases_1[_i], to = _a[0], from = _a[1];
24408
- var paintProp = paint[from];
24409
- if (defined(this.options.opacity) &&
24410
- from.toLowerCase().indexOf('opacity') !== -1) {
24411
- paintProp = Number(paintProp) * this.options.opacity;
24412
- }
24413
- if (paintProp !== undefined) {
24414
- Object.defineProperty(readyPaint, to, {
24415
- enumerable: true,
24416
- value: paintProp,
24417
- });
24418
- }
24419
- }
24420
- return readyPaint;
24421
- }
24422
- return PAINT;
24423
- };
24424
24548
  GeoJsonAdapter.prototype._getGeoJsonOptions = function (options, type) {
24425
24549
  var _this = this;
24426
24550
  var paint = options.paint;
@@ -24430,7 +24554,7 @@ var NgwLeaflet = (function () {
24430
24554
  // TODO: fix types (@geoman-io/leaflet-geoman-free)
24431
24555
  lopt.pointToLayer = function (feature, latLng) {
24432
24556
  var iconOpt = paint(feature);
24433
- var pointToLayer = _this._createPaintToLayer(iconOpt);
24557
+ var pointToLayer = _this._paint.createPaintToLayer(iconOpt);
24434
24558
  return pointToLayer(feature, latLng);
24435
24559
  };
24436
24560
  }
@@ -24438,17 +24562,17 @@ var NgwLeaflet = (function () {
24438
24562
  lopt = {
24439
24563
  style: function (feature) {
24440
24564
  if (feature) {
24441
- return _this._preparePaint(__assign(__assign({}, PAINT), paint(feature)));
24565
+ return _this._paint.preparePaint(__assign(__assign({}, PAINT), paint(feature)));
24442
24566
  }
24443
24567
  else {
24444
- return _this._preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
24568
+ return _this._paint.preparePaint(__assign(__assign({}, PAINT), { type: 'path' }));
24445
24569
  }
24446
24570
  },
24447
24571
  };
24448
24572
  }
24449
24573
  }
24450
24574
  else {
24451
- lopt = this._createPaintOptions(paint, type);
24575
+ lopt = this._paint.createPaintOptions(paint);
24452
24576
  }
24453
24577
  lopt.onEachFeature = function (feature, layer) {
24454
24578
  _this._onEachFeature(feature, layer);
@@ -24460,7 +24584,6 @@ var NgwLeaflet = (function () {
24460
24584
  var layer_ = this.layer;
24461
24585
  if (layer_) {
24462
24586
  var def_2 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
24463
- // @ts-ignore
24464
24587
  layer.options.pane = this.pane;
24465
24588
  this._layers.push(def_2);
24466
24589
  var ok = true;
@@ -24485,7 +24608,7 @@ var NgwLeaflet = (function () {
24485
24608
  layer.on('click', function (e) { return _this._selectOnLayerClick(e); }, this);
24486
24609
  }
24487
24610
  }
24488
- this._handleMouseEvents(layer);
24611
+ this._events.handleMouseEvents(layer);
24489
24612
  // The timeout is needed to display the popup immediately when adding a layer to the map.
24490
24613
  // Without a timeout, the layer may not yet have a _map object
24491
24614
  setTimeout(function () {
@@ -24497,37 +24620,6 @@ var NgwLeaflet = (function () {
24497
24620
  }
24498
24621
  }
24499
24622
  };
24500
- GeoJsonAdapter.prototype._handleMouseEvents = function (layer) {
24501
- var _this = this;
24502
- var _a = this.options, onClick = _a.onClick, onLayerClick = _a.onLayerClick, onMouseOut = _a.onMouseOut, onMouseOver = _a.onMouseOver;
24503
- // TODO: remove backward compatibility for onLayerClick
24504
- var onClick_ = onClick || onLayerClick;
24505
- if (onClick_) {
24506
- layer.on('click', function (e) {
24507
- var selected = !!_this._getSelected(layer);
24508
- onClick_(__assign({ selected: selected }, _this._createMouseEvent(e)));
24509
- }, this);
24510
- }
24511
- if (onMouseOut) {
24512
- layer.on('mouseout', function (e) {
24513
- onMouseOut(_this._createMouseEvent(e));
24514
- }, this);
24515
- }
24516
- if (onMouseOver) {
24517
- layer.on('mouseover', function (e) {
24518
- onMouseOver(_this._createMouseEvent(e));
24519
- }, this);
24520
- }
24521
- };
24522
- GeoJsonAdapter.prototype._createMouseEvent = function (source) {
24523
- return createMouseEvent({
24524
- layer: this,
24525
- source: source,
24526
- });
24527
- };
24528
- GeoJsonAdapter.prototype._getSelected = function (layer) {
24529
- return this._selectedLayers.find(function (x) { return x.layer === layer; });
24530
- };
24531
24623
  GeoJsonAdapter.prototype._selectOnLayerClick = function (e) {
24532
24624
  leafletSrc.exports.DomEvent.stopPropagation(e);
24533
24625
  var layer = e.target;
@@ -24557,7 +24649,7 @@ var NgwLeaflet = (function () {
24557
24649
  this.selected = true;
24558
24650
  var _a = this.options, selectedPaint = _a.selectedPaint, popupOnSelect = _a.popupOnSelect, popupOptions = _a.popupOptions;
24559
24651
  if (selectedPaint && def.layer) {
24560
- this._setPaint(def, selectedPaint);
24652
+ this._paint.setPaint(def, selectedPaint);
24561
24653
  }
24562
24654
  if (popupOnSelect) {
24563
24655
  this._openPopup(def, popupOptions, type, latlng);
@@ -24573,7 +24665,7 @@ var NgwLeaflet = (function () {
24573
24665
  this._selectedLayers.splice(index, 1);
24574
24666
  if (this.options) {
24575
24667
  if (this.options.paint) {
24576
- this._setPaint(def, this.options.paint);
24668
+ this._paint.setPaint(def, this.options.paint);
24577
24669
  }
24578
24670
  if (this.options.popupOnSelect && def.layer) {
24579
24671
  this._removePopup(def.layer);
@@ -24582,51 +24674,6 @@ var NgwLeaflet = (function () {
24582
24674
  }
24583
24675
  this.selected = this._selectedLayers.length > 0;
24584
24676
  };
24585
- GeoJsonAdapter.prototype._createDivIcon = function (icon) {
24586
- var toLIconOpt = __rest(icon, []);
24587
- return new leafletSrc.exports.DivIcon(__assign({ className: '' }, toLIconOpt));
24588
- };
24589
- GeoJsonAdapter.prototype._createPaintToLayer = function (icon) {
24590
- var _this = this;
24591
- if (icon && icon.type) {
24592
- if (icon.type === 'icon') {
24593
- var iconClassName = icon.className;
24594
- var html = icon.html;
24595
- if (iconClassName || html) {
24596
- return function (geoJsonPoint, latlng) {
24597
- var divIcon = _this._createDivIcon(icon);
24598
- return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
24599
- };
24600
- }
24601
- }
24602
- else if (icon.type === 'pin') {
24603
- return function (geoJsonPoint, latlng) {
24604
- // const divIcon = this.createDivIcon(icon);
24605
- return new leafletSrc.exports.Marker(latlng);
24606
- };
24607
- }
24608
- }
24609
- return function (geoJsonPoint, latlng) {
24610
- var p = PAINT;
24611
- return new leafletSrc.exports.CircleMarker(latlng, _this._preparePaint(__assign(__assign({}, p), icon)));
24612
- };
24613
- };
24614
- GeoJsonAdapter.prototype._createPaintOptions = function (paintOptions, type) {
24615
- var geoJsonOptions = {};
24616
- var paint = (paintOptions && this._preparePaint(paintOptions)) || {};
24617
- if (paintOptions) {
24618
- geoJsonOptions.style = function () {
24619
- return paint;
24620
- };
24621
- }
24622
- if (type === 'point') {
24623
- geoJsonOptions.pointToLayer = this._createPaintToLayer(paintOptions);
24624
- }
24625
- else if (type === 'line') {
24626
- paint.stroke = true;
24627
- }
24628
- return geoJsonOptions;
24629
- };
24630
24677
  GeoJsonAdapter.prototype._addMapClickListener = function () {
24631
24678
  var map = this.map;
24632
24679
  if (map) {