@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
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -19016,8 +19016,9 @@ class NgwConnector {
19016
19016
  * ```
19017
19017
  */
19018
19018
  apiRequest(name, params_ = {}, requestOptions = {}) {
19019
- var _a;
19019
+ var _a, _b;
19020
19020
  const { method, headers, withCredentials, responseType } = requestOptions;
19021
+ params_ = (_a = requestOptions.params) !== null && _a !== void 0 ? _a : params_;
19021
19022
  const params = objectRemoveEmpty(params_);
19022
19023
  const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
19023
19024
  if (requestOptions.cache && method === 'GET') {
@@ -19029,7 +19030,7 @@ class NgwConnector {
19029
19030
  withCredentials,
19030
19031
  responseType,
19031
19032
  baseUrl: this.options.baseUrl,
19032
- userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
19033
+ userId: (_b = this.user) === null || _b === void 0 ? void 0 : _b.id,
19033
19034
  }),
19034
19035
  });
19035
19036
  }
@@ -22077,15 +22078,16 @@ const svgPath = {
22077
22078
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
22078
22079
  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"/>',
22079
22080
  };
22081
+ const VIEW_BOX = 12;
22080
22082
  const STROKE = 0.8;
22081
- function generateSvg(width, height, stroke = 0, content) {
22083
+ function generateSvg({ width, height, stroke = 0, content, }) {
22082
22084
  const s = stroke / 2;
22083
22085
  const svg = `<svg
22084
22086
  version="1.1"
22085
22087
  xmlns="http://www.w3.org/2000/svg"
22086
22088
  width="${width}"
22087
22089
  height="${height}"
22088
- viewBox="-${s} -${s} ${width + stroke} ${height + stroke}"
22090
+ viewBox="-${s} -${s} ${VIEW_BOX + stroke} ${VIEW_BOX + stroke}"
22089
22091
  >${content}</svg>`;
22090
22092
  return svg;
22091
22093
  }
@@ -22094,36 +22096,45 @@ function insertSvg(svg) {
22094
22096
  const oDOM = oParser.parseFromString(svg, 'image/svg+xml');
22095
22097
  return oDOM.documentElement;
22096
22098
  }
22099
+ /**
22100
+ * Retrieves an icon with the provided options.
22101
+ * @function
22102
+ * @param {IconOptions} [opt={}] - Options for the icon.
22103
+ * @returns {IconPaint} Icon paint object.
22104
+ */
22097
22105
  function getIcon(opt = {}) {
22098
- var _a, _b, _c, _d, _e;
22099
- // default values
22106
+ var _a, _b, _c, _d, _e, _f;
22107
+ // Default values
22100
22108
  const shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
22101
22109
  const color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
22102
22110
  const strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
22103
- const size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
22111
+ const size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
22104
22112
  const rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
22105
- const anchor = size / 2;
22106
- const defSize = 12;
22113
+ const anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
22107
22114
  const stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
22108
- const scale = size / defSize;
22109
22115
  const pathAlias = opt.p || svgPath[shape] || 'circle';
22110
22116
  const path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
22111
- const svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
22112
- const fistChild = svg.firstChild;
22113
- const scaledAnchor = defSize / 2;
22114
- const transform = `scale(${scale}) rotate(${rotate}, ${scaledAnchor}, ${scaledAnchor})`;
22115
- fistChild.setAttribute('fill', color);
22117
+ const svg = insertSvg(opt.svg ||
22118
+ generateSvg({
22119
+ width: size,
22120
+ height: size,
22121
+ stroke,
22122
+ content: path,
22123
+ }));
22124
+ svg.setAttribute('width', String(size));
22125
+ svg.setAttribute('height', String(size));
22126
+ svg.setAttribute('fill', color);
22116
22127
  if (stroke) {
22117
- fistChild.setAttribute('stroke', strokeColor);
22118
- fistChild.setAttribute('stroke-width', String(stroke));
22128
+ svg.setAttribute('stroke', strokeColor);
22129
+ svg.setAttribute('stroke-width', String(stroke));
22119
22130
  }
22120
- fistChild.setAttribute('transform', transform);
22121
22131
  const s = new XMLSerializer();
22122
22132
  return {
22123
22133
  type: 'icon',
22124
22134
  iconSize: [size, size],
22125
- iconAnchor: [anchor, anchor],
22135
+ iconAnchor: anchor,
22126
22136
  html: s.serializeToString(svg),
22137
+ rotate,
22127
22138
  svg,
22128
22139
  };
22129
22140
  }
@@ -22928,19 +22939,6 @@ function createFeaturePositionOptions(features) {
22928
22939
  };
22929
22940
  }
22930
22941
 
22931
- function createMouseEvent({ layer, source, }) {
22932
- const layer_ = source.target;
22933
- const feature = layer_.feature;
22934
- const opt = {
22935
- layer,
22936
- feature,
22937
- event: convertMapClickEvent(source),
22938
- source,
22939
- ...createFeaturePositionOptions(feature),
22940
- };
22941
- return opt;
22942
- }
22943
-
22944
22942
  function findMostFrequentGeomType(arr) {
22945
22943
  const counts = {};
22946
22944
  for (let fry = 0; fry < arr.length; fry++) {
@@ -22995,6 +22993,201 @@ class BaseAdapter {
22995
22993
  }
22996
22994
  }
22997
22995
 
22996
+ function createMouseEvent({ layer, source, }) {
22997
+ const layer_ = source.target;
22998
+ const feature = layer_.feature;
22999
+ const opt = {
23000
+ layer,
23001
+ feature,
23002
+ event: convertMapClickEvent(source),
23003
+ source,
23004
+ ...createFeaturePositionOptions(feature),
23005
+ };
23006
+ return opt;
23007
+ }
23008
+
23009
+ class GeoJsonEvents {
23010
+ constructor(layer) {
23011
+ this.layer = layer;
23012
+ }
23013
+ handleMouseEvents(layer) {
23014
+ const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
23015
+ // TODO: remove backward compatibility for onLayerClick
23016
+ const onClick_ = onClick || onLayerClick;
23017
+ if (onClick_) {
23018
+ this._onclick = (e) => {
23019
+ const selected = !!this.layer._getSelected(layer);
23020
+ onClick_({
23021
+ selected,
23022
+ ...this._createMouseEvent(e),
23023
+ });
23024
+ };
23025
+ layer.on('click', this._onclick, this);
23026
+ }
23027
+ if (onMouseOut) {
23028
+ this._mouseout = (e) => {
23029
+ onMouseOut(this._createMouseEvent(e));
23030
+ };
23031
+ layer.on('mouseout', this._mouseout, this);
23032
+ }
23033
+ if (onMouseOver) {
23034
+ this._mouseover = (e) => {
23035
+ onMouseOver(this._createMouseEvent(e));
23036
+ };
23037
+ layer.on('mouseover', this._mouseover, this);
23038
+ }
23039
+ }
23040
+ stopMouseEvents(layer) {
23041
+ if (this._mouseover) {
23042
+ layer.off('mouseover', this._mouseover, this);
23043
+ }
23044
+ if (this._mouseout) {
23045
+ layer.off('mouseout', this._mouseout, this);
23046
+ }
23047
+ if (this._onclick) {
23048
+ layer.off('click', this._onclick, this);
23049
+ }
23050
+ }
23051
+ _createMouseEvent(source) {
23052
+ return createMouseEvent({
23053
+ layer: this.layer,
23054
+ source: source,
23055
+ });
23056
+ }
23057
+ }
23058
+
23059
+ class GeoJsonPaint {
23060
+ constructor(layer) {
23061
+ this.layer = layer;
23062
+ }
23063
+ setPaintEachLayer(paint) {
23064
+ this.layer._layers.forEach((layerDef) => {
23065
+ this.setPaint(layerDef, paint);
23066
+ });
23067
+ }
23068
+ setPaint(layerDef, paint) {
23069
+ let style = undefined;
23070
+ const { layer, feature } = layerDef;
23071
+ if (layer && feature) {
23072
+ if (isPaintCallback(paint)) {
23073
+ style = paint(feature);
23074
+ }
23075
+ else if (isPaint(paint)) {
23076
+ style = paint;
23077
+ }
23078
+ if (style) {
23079
+ if (this.layer.type === 'point' && style.type === 'icon') {
23080
+ const marker = layer;
23081
+ const divIcon = this._createDivIcon(style);
23082
+ setTimeout(() => {
23083
+ marker.setIcon(divIcon);
23084
+ }, 10);
23085
+ }
23086
+ else if ('setStyle' in layer) {
23087
+ layer.setStyle(this.preparePaint(style));
23088
+ }
23089
+ }
23090
+ }
23091
+ }
23092
+ preparePaint(paint) {
23093
+ if (paint.type !== 'get-paint') {
23094
+ const paintAliases = [
23095
+ ['color', 'strokeColor'],
23096
+ ['opacity', 'strokeOpacity'],
23097
+ ['stroke', 'stroke'],
23098
+ ['fillColor', 'fillColor'],
23099
+ ['fillOpacity', 'fillOpacity'],
23100
+ ['fill', 'fill'],
23101
+ ['weight', 'weight'],
23102
+ ];
23103
+ const aliases = this.layer.type === 'line'
23104
+ ? [
23105
+ ['color', 'strokeColor'],
23106
+ ['opacity', 'strokeOpacity'],
23107
+ ['weight', 'weight'],
23108
+ ]
23109
+ : paintAliases;
23110
+ const readyPaint = {};
23111
+ if ('radius' in paint && typeof paint.radius === 'number') {
23112
+ readyPaint.radius = paint.radius;
23113
+ }
23114
+ for (const [to, from] of aliases) {
23115
+ const opacity = this.layer.options.opacity;
23116
+ let paintProp = paint[from];
23117
+ if (defined(opacity) && from.toLowerCase().indexOf('opacity') !== -1) {
23118
+ paintProp = Number(paintProp) * opacity;
23119
+ }
23120
+ if (paintProp !== undefined) {
23121
+ Object.defineProperty(readyPaint, to, {
23122
+ enumerable: true,
23123
+ value: paintProp,
23124
+ });
23125
+ }
23126
+ }
23127
+ return readyPaint;
23128
+ }
23129
+ return PAINT;
23130
+ }
23131
+ _createDivIcon(icon) {
23132
+ const { html, rotate, className, ...toLIconOpt } = icon;
23133
+ const element = document.createElement('div');
23134
+ if (className) {
23135
+ element.className = className;
23136
+ }
23137
+ if (rotate) {
23138
+ element.style.transform = `rotateZ(${rotate}deg)`;
23139
+ }
23140
+ if (html) {
23141
+ element.innerHTML = html;
23142
+ }
23143
+ const divIcon = new leafletSrc.exports.DivIcon({
23144
+ className: '',
23145
+ ...toLIconOpt,
23146
+ html: element,
23147
+ });
23148
+ return divIcon;
23149
+ }
23150
+ createPaintToLayer(icon) {
23151
+ if (icon && icon.type) {
23152
+ if (icon.type === 'icon') {
23153
+ const iconClassName = icon.className;
23154
+ const html = icon.html;
23155
+ if (iconClassName || html) {
23156
+ return (_, latlng) => {
23157
+ const divIcon = this._createDivIcon(icon);
23158
+ return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
23159
+ };
23160
+ }
23161
+ }
23162
+ else if (icon.type === 'pin') {
23163
+ return (_, latlng) => {
23164
+ return new leafletSrc.exports.Marker(latlng);
23165
+ };
23166
+ }
23167
+ }
23168
+ return (_, latlng) => {
23169
+ const p = PAINT;
23170
+ return new leafletSrc.exports.CircleMarker(latlng, this.preparePaint({ ...p, ...icon }));
23171
+ };
23172
+ }
23173
+ createPaintOptions(paint) {
23174
+ const geoJsonOptions = {};
23175
+ const newPaint = this.preparePaint(paint);
23176
+ if (paint) {
23177
+ geoJsonOptions.style = () => {
23178
+ return newPaint;
23179
+ };
23180
+ }
23181
+ if (this.layer.type === 'point') {
23182
+ geoJsonOptions.pointToLayer = this.createPaintToLayer(paint);
23183
+ }
23184
+ else if (this.layer.type === 'line') {
23185
+ newPaint.stroke = true;
23186
+ }
23187
+ return geoJsonOptions;
23188
+ }
23189
+ }
23190
+
22998
23191
  class GeoJsonAdapter extends BaseAdapter {
22999
23192
  constructor(map, options) {
23000
23193
  super(map, options);
@@ -23009,6 +23202,8 @@ class GeoJsonAdapter extends BaseAdapter {
23009
23202
  this.$unselect = () => {
23010
23203
  this.unselect();
23011
23204
  };
23205
+ this._events = new GeoJsonEvents(this);
23206
+ this._paint = new GeoJsonPaint(this);
23012
23207
  }
23013
23208
  addLayer(options) {
23014
23209
  Object.assign(this.options, options);
@@ -23039,7 +23234,7 @@ class GeoJsonAdapter extends BaseAdapter {
23039
23234
  else if (!this.selected) {
23040
23235
  this.selected = true;
23041
23236
  if (this.selectedPaint) {
23042
- this._setPaintEachLayer(this.selectedPaint);
23237
+ this._paint.setPaintEachLayer(this.selectedPaint);
23043
23238
  }
23044
23239
  }
23045
23240
  }
@@ -23055,7 +23250,7 @@ class GeoJsonAdapter extends BaseAdapter {
23055
23250
  this._removePopup(p[0]);
23056
23251
  }
23057
23252
  if (this.paint) {
23058
- this._setPaintEachLayer(this.paint);
23253
+ this._paint.setPaintEachLayer(this.paint);
23059
23254
  }
23060
23255
  this._selectedLayers.length = 0;
23061
23256
  this.selected = false;
@@ -23226,7 +23421,7 @@ class GeoJsonAdapter extends BaseAdapter {
23226
23421
  if (paint) {
23227
23422
  this.paint = paint;
23228
23423
  for (const l of this._layers) {
23229
- this._setPaint(l, paint);
23424
+ this._paint.setPaint(l, paint);
23230
23425
  }
23231
23426
  }
23232
23427
  }
@@ -23234,22 +23429,25 @@ class GeoJsonAdapter extends BaseAdapter {
23234
23429
  if (paint) {
23235
23430
  this.selectedPaint = paint;
23236
23431
  for (const l of this._selectedLayers) {
23237
- this._setPaint(l, paint);
23432
+ this._paint.setPaint(l, paint);
23238
23433
  }
23239
23434
  }
23240
23435
  }
23241
23436
  updatePaint(paint) {
23242
23437
  this.paint = { ...this.paint, ...paint };
23243
23438
  for (const l of this._layers) {
23244
- this._setPaint(l, this.paint);
23439
+ this._paint.setPaint(l, this.paint);
23245
23440
  }
23246
23441
  }
23247
23442
  updateSelectedPaint(paint) {
23248
23443
  this.selectedPaint = { ...this.selectedPaint, ...paint };
23249
23444
  for (const l of this._selectedLayers) {
23250
- this._setPaint(l, this.selectedPaint);
23445
+ this._paint.setPaint(l, this.selectedPaint);
23251
23446
  }
23252
23447
  }
23448
+ _getSelected(layer) {
23449
+ return this._selectedLayers.find((x) => x.layer === layer);
23450
+ }
23253
23451
  _updateTooltip(layerDef) {
23254
23452
  const { feature, layer } = layerDef;
23255
23453
  if (feature && layer && feature.properties && this.options.labelField) {
@@ -23339,77 +23537,6 @@ class GeoJsonAdapter extends BaseAdapter {
23339
23537
  }
23340
23538
  }
23341
23539
  }
23342
- _setPaintEachLayer(paint) {
23343
- this._layers.forEach((l) => {
23344
- this._setPaint(l, paint);
23345
- });
23346
- }
23347
- _setPaint(def, paint) {
23348
- let style = undefined;
23349
- const { layer, feature } = def;
23350
- if (layer && feature) {
23351
- if (isPaintCallback(paint)) {
23352
- style = paint(feature);
23353
- }
23354
- else if (isPaint(paint)) {
23355
- style = paint;
23356
- }
23357
- if (style) {
23358
- if (this.type === 'point' && style.type === 'icon') {
23359
- const marker = layer;
23360
- const divIcon = this._createDivIcon(style);
23361
- marker.setIcon(divIcon);
23362
- }
23363
- else if ('setStyle' in layer) {
23364
- layer.setStyle(this._preparePaint(style));
23365
- }
23366
- }
23367
- }
23368
- }
23369
- _preparePaint(paint) {
23370
- if (paint.type !== 'get-paint') {
23371
- // const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
23372
- // if (path.opacity) {
23373
- // path.fillOpacity = path.opacity;
23374
- // }
23375
- const paintAliases = [
23376
- // ['color', 'color'],
23377
- ['color', 'strokeColor'],
23378
- ['opacity', 'strokeOpacity'],
23379
- ['stroke', 'stroke'],
23380
- ['fillColor', 'fillColor'],
23381
- ['fillOpacity', 'fillOpacity'],
23382
- ['fill', 'fill'],
23383
- ['weight', 'weight'],
23384
- ];
23385
- const aliases = this.type === 'line'
23386
- ? [
23387
- ['color', 'strokeColor'],
23388
- ['opacity', 'strokeOpacity'],
23389
- ['weight', 'weight'],
23390
- ]
23391
- : paintAliases;
23392
- const readyPaint = {};
23393
- if ('radius' in paint && typeof paint.radius === 'number') {
23394
- readyPaint.radius = paint.radius;
23395
- }
23396
- for (const [to, from] of aliases) {
23397
- let paintProp = paint[from];
23398
- if (defined(this.options.opacity) &&
23399
- from.toLowerCase().indexOf('opacity') !== -1) {
23400
- paintProp = Number(paintProp) * this.options.opacity;
23401
- }
23402
- if (paintProp !== undefined) {
23403
- Object.defineProperty(readyPaint, to, {
23404
- enumerable: true,
23405
- value: paintProp,
23406
- });
23407
- }
23408
- }
23409
- return readyPaint;
23410
- }
23411
- return PAINT;
23412
- }
23413
23540
  _getGeoJsonOptions(options, type) {
23414
23541
  const paint = options.paint;
23415
23542
  let lopt = {};
@@ -23418,7 +23545,7 @@ class GeoJsonAdapter extends BaseAdapter {
23418
23545
  // TODO: fix types (@geoman-io/leaflet-geoman-free)
23419
23546
  lopt.pointToLayer = (feature, latLng) => {
23420
23547
  const iconOpt = paint(feature);
23421
- const pointToLayer = this._createPaintToLayer(iconOpt);
23548
+ const pointToLayer = this._paint.createPaintToLayer(iconOpt);
23422
23549
  return pointToLayer(feature, latLng);
23423
23550
  };
23424
23551
  }
@@ -23426,17 +23553,17 @@ class GeoJsonAdapter extends BaseAdapter {
23426
23553
  lopt = {
23427
23554
  style: (feature) => {
23428
23555
  if (feature) {
23429
- return this._preparePaint({ ...PAINT, ...paint(feature) });
23556
+ return this._paint.preparePaint({ ...PAINT, ...paint(feature) });
23430
23557
  }
23431
23558
  else {
23432
- return this._preparePaint({ ...PAINT, type: 'path' });
23559
+ return this._paint.preparePaint({ ...PAINT, type: 'path' });
23433
23560
  }
23434
23561
  },
23435
23562
  };
23436
23563
  }
23437
23564
  }
23438
23565
  else {
23439
- lopt = this._createPaintOptions(paint, type);
23566
+ lopt = this._paint.createPaintOptions(paint);
23440
23567
  }
23441
23568
  lopt.onEachFeature = (feature, layer) => {
23442
23569
  this._onEachFeature(feature, layer);
@@ -23452,7 +23579,6 @@ class GeoJsonAdapter extends BaseAdapter {
23452
23579
  layer,
23453
23580
  ...createFeaturePositionOptions(feature),
23454
23581
  };
23455
- // @ts-ignore
23456
23582
  layer.options.pane = this.pane;
23457
23583
  this._layers.push(def);
23458
23584
  let ok = true;
@@ -23477,7 +23603,7 @@ class GeoJsonAdapter extends BaseAdapter {
23477
23603
  layer.on('click', (e) => this._selectOnLayerClick(e), this);
23478
23604
  }
23479
23605
  }
23480
- this._handleMouseEvents(layer);
23606
+ this._events.handleMouseEvents(layer);
23481
23607
  // The timeout is needed to display the popup immediately when adding a layer to the map.
23482
23608
  // Without a timeout, the layer may not yet have a _map object
23483
23609
  setTimeout(() => {
@@ -23494,39 +23620,6 @@ class GeoJsonAdapter extends BaseAdapter {
23494
23620
  }
23495
23621
  }
23496
23622
  }
23497
- _handleMouseEvents(layer) {
23498
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.options;
23499
- // TODO: remove backward compatibility for onLayerClick
23500
- const onClick_ = onClick || onLayerClick;
23501
- if (onClick_) {
23502
- layer.on('click', (e) => {
23503
- const selected = !!this._getSelected(layer);
23504
- onClick_({
23505
- selected,
23506
- ...this._createMouseEvent(e),
23507
- });
23508
- }, this);
23509
- }
23510
- if (onMouseOut) {
23511
- layer.on('mouseout', (e) => {
23512
- onMouseOut(this._createMouseEvent(e));
23513
- }, this);
23514
- }
23515
- if (onMouseOver) {
23516
- layer.on('mouseover', (e) => {
23517
- onMouseOver(this._createMouseEvent(e));
23518
- }, this);
23519
- }
23520
- }
23521
- _createMouseEvent(source) {
23522
- return createMouseEvent({
23523
- layer: this,
23524
- source: source,
23525
- });
23526
- }
23527
- _getSelected(layer) {
23528
- return this._selectedLayers.find((x) => x.layer === layer);
23529
- }
23530
23623
  _selectOnLayerClick(e) {
23531
23624
  leafletSrc.exports.DomEvent.stopPropagation(e);
23532
23625
  const layer = e.target;
@@ -23560,7 +23653,7 @@ class GeoJsonAdapter extends BaseAdapter {
23560
23653
  this.selected = true;
23561
23654
  const { selectedPaint, popupOnSelect, popupOptions } = this.options;
23562
23655
  if (selectedPaint && def.layer) {
23563
- this._setPaint(def, selectedPaint);
23656
+ this._paint.setPaint(def, selectedPaint);
23564
23657
  }
23565
23658
  if (popupOnSelect) {
23566
23659
  this._openPopup(def, popupOptions, type, latlng);
@@ -23581,7 +23674,7 @@ class GeoJsonAdapter extends BaseAdapter {
23581
23674
  this._selectedLayers.splice(index, 1);
23582
23675
  if (this.options) {
23583
23676
  if (this.options.paint) {
23584
- this._setPaint(def, this.options.paint);
23677
+ this._paint.setPaint(def, this.options.paint);
23585
23678
  }
23586
23679
  if (this.options.popupOnSelect && def.layer) {
23587
23680
  this._removePopup(def.layer);
@@ -23590,50 +23683,6 @@ class GeoJsonAdapter extends BaseAdapter {
23590
23683
  }
23591
23684
  this.selected = this._selectedLayers.length > 0;
23592
23685
  }
23593
- _createDivIcon(icon) {
23594
- const { ...toLIconOpt } = icon;
23595
- return new leafletSrc.exports.DivIcon({ className: '', ...toLIconOpt });
23596
- }
23597
- _createPaintToLayer(icon) {
23598
- if (icon && icon.type) {
23599
- if (icon.type === 'icon') {
23600
- const iconClassName = icon.className;
23601
- const html = icon.html;
23602
- if (iconClassName || html) {
23603
- return (geoJsonPoint, latlng) => {
23604
- const divIcon = this._createDivIcon(icon);
23605
- return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
23606
- };
23607
- }
23608
- }
23609
- else if (icon.type === 'pin') {
23610
- return (geoJsonPoint, latlng) => {
23611
- // const divIcon = this.createDivIcon(icon);
23612
- return new leafletSrc.exports.Marker(latlng);
23613
- };
23614
- }
23615
- }
23616
- return (geoJsonPoint, latlng) => {
23617
- const p = PAINT;
23618
- return new leafletSrc.exports.CircleMarker(latlng, this._preparePaint({ ...p, ...icon }));
23619
- };
23620
- }
23621
- _createPaintOptions(paintOptions, type) {
23622
- const geoJsonOptions = {};
23623
- const paint = (paintOptions && this._preparePaint(paintOptions)) || {};
23624
- if (paintOptions) {
23625
- geoJsonOptions.style = () => {
23626
- return paint;
23627
- };
23628
- }
23629
- if (type === 'point') {
23630
- geoJsonOptions.pointToLayer = this._createPaintToLayer(paintOptions);
23631
- }
23632
- else if (type === 'line') {
23633
- paint.stroke = true;
23634
- }
23635
- return geoJsonOptions;
23636
- }
23637
23686
  _addMapClickListener() {
23638
23687
  const map = this.map;
23639
23688
  if (map) {