@nextgis/ngw-leaflet 1.18.2 → 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.2; 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
  }
@@ -19457,8 +19458,10 @@ function createGeoJsonFeature(item) {
19457
19458
  return feature;
19458
19459
  }
19459
19460
  function updateItemRequestParam(params, options) {
19460
- const { extensions, geom, fields, srs } = options;
19461
- params.extensions = extensions ? extensions.join(',') : '';
19461
+ const { extensions, geom, fields, srs, ilike, like } = options;
19462
+ if (extensions) {
19463
+ params.extensions = extensions.join(',');
19464
+ }
19462
19465
  if (fields !== undefined) {
19463
19466
  params.fields = Array.isArray(fields) ? fields.join(',') : '';
19464
19467
  }
@@ -19469,6 +19472,12 @@ function updateItemRequestParam(params, options) {
19469
19472
  delete params.geom_format;
19470
19473
  }
19471
19474
  }
19475
+ if (defined(ilike)) {
19476
+ params.ilike = ilike;
19477
+ }
19478
+ else if (defined(like)) {
19479
+ params.like = like;
19480
+ }
19472
19481
  if (defined(srs)) {
19473
19482
  params.srs = srs;
19474
19483
  }
@@ -22069,15 +22078,16 @@ const svgPath = {
22069
22078
  minus: '<path d="m12 7.5v-3h-12v3z"/>',
22070
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"/>',
22071
22080
  };
22081
+ const VIEW_BOX = 12;
22072
22082
  const STROKE = 0.8;
22073
- function generateSvg(width, height, stroke = 0, content) {
22083
+ function generateSvg({ width, height, stroke = 0, content, }) {
22074
22084
  const s = stroke / 2;
22075
22085
  const svg = `<svg
22076
22086
  version="1.1"
22077
22087
  xmlns="http://www.w3.org/2000/svg"
22078
22088
  width="${width}"
22079
22089
  height="${height}"
22080
- viewBox="-${s} -${s} ${width + stroke} ${height + stroke}"
22090
+ viewBox="-${s} -${s} ${VIEW_BOX + stroke} ${VIEW_BOX + stroke}"
22081
22091
  >${content}</svg>`;
22082
22092
  return svg;
22083
22093
  }
@@ -22086,36 +22096,45 @@ function insertSvg(svg) {
22086
22096
  const oDOM = oParser.parseFromString(svg, 'image/svg+xml');
22087
22097
  return oDOM.documentElement;
22088
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
+ */
22089
22105
  function getIcon(opt = {}) {
22090
- var _a, _b, _c, _d, _e;
22091
- // default values
22106
+ var _a, _b, _c, _d, _e, _f;
22107
+ // Default values
22092
22108
  const shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
22093
22109
  const color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
22094
22110
  const strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
22095
- const size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
22111
+ const size = (_d = opt.size) !== null && _d !== void 0 ? _d : VIEW_BOX;
22096
22112
  const rotate = (_e = opt.rotate) !== null && _e !== void 0 ? _e : 0;
22097
- const anchor = size / 2;
22098
- const defSize = 12;
22113
+ const anchor = (_f = opt.anchor) !== null && _f !== void 0 ? _f : [size / 2, size / 2];
22099
22114
  const stroke = opt.stroke !== undefined ? Number(opt.stroke) : STROKE;
22100
- const scale = size / defSize;
22101
22115
  const pathAlias = opt.p || svgPath[shape] || 'circle';
22102
22116
  const path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
22103
- const svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
22104
- const fistChild = svg.firstChild;
22105
- const scaledAnchor = defSize / 2;
22106
- const transform = `scale(${scale}) rotate(${rotate}, ${scaledAnchor}, ${scaledAnchor})`;
22107
- 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);
22108
22127
  if (stroke) {
22109
- fistChild.setAttribute('stroke', strokeColor);
22110
- fistChild.setAttribute('stroke-width', String(stroke));
22128
+ svg.setAttribute('stroke', strokeColor);
22129
+ svg.setAttribute('stroke-width', String(stroke));
22111
22130
  }
22112
- fistChild.setAttribute('transform', transform);
22113
22131
  const s = new XMLSerializer();
22114
22132
  return {
22115
22133
  type: 'icon',
22116
22134
  iconSize: [size, size],
22117
- iconAnchor: [anchor, anchor],
22135
+ iconAnchor: anchor,
22118
22136
  html: s.serializeToString(svg),
22137
+ rotate,
22119
22138
  svg,
22120
22139
  };
22121
22140
  }
@@ -22920,19 +22939,6 @@ function createFeaturePositionOptions(features) {
22920
22939
  };
22921
22940
  }
22922
22941
 
22923
- function createMouseEvent({ layer, source, }) {
22924
- const layer_ = source.target;
22925
- const feature = layer_.feature;
22926
- const opt = {
22927
- layer,
22928
- feature,
22929
- event: convertMapClickEvent(source),
22930
- source,
22931
- ...createFeaturePositionOptions(feature),
22932
- };
22933
- return opt;
22934
- }
22935
-
22936
22942
  function findMostFrequentGeomType(arr) {
22937
22943
  const counts = {};
22938
22944
  for (let fry = 0; fry < arr.length; fry++) {
@@ -22987,6 +22993,201 @@ class BaseAdapter {
22987
22993
  }
22988
22994
  }
22989
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
+
22990
23191
  class GeoJsonAdapter extends BaseAdapter {
22991
23192
  constructor(map, options) {
22992
23193
  super(map, options);
@@ -23001,6 +23202,8 @@ class GeoJsonAdapter extends BaseAdapter {
23001
23202
  this.$unselect = () => {
23002
23203
  this.unselect();
23003
23204
  };
23205
+ this._events = new GeoJsonEvents(this);
23206
+ this._paint = new GeoJsonPaint(this);
23004
23207
  }
23005
23208
  addLayer(options) {
23006
23209
  Object.assign(this.options, options);
@@ -23031,7 +23234,7 @@ class GeoJsonAdapter extends BaseAdapter {
23031
23234
  else if (!this.selected) {
23032
23235
  this.selected = true;
23033
23236
  if (this.selectedPaint) {
23034
- this._setPaintEachLayer(this.selectedPaint);
23237
+ this._paint.setPaintEachLayer(this.selectedPaint);
23035
23238
  }
23036
23239
  }
23037
23240
  }
@@ -23047,7 +23250,7 @@ class GeoJsonAdapter extends BaseAdapter {
23047
23250
  this._removePopup(p[0]);
23048
23251
  }
23049
23252
  if (this.paint) {
23050
- this._setPaintEachLayer(this.paint);
23253
+ this._paint.setPaintEachLayer(this.paint);
23051
23254
  }
23052
23255
  this._selectedLayers.length = 0;
23053
23256
  this.selected = false;
@@ -23218,7 +23421,7 @@ class GeoJsonAdapter extends BaseAdapter {
23218
23421
  if (paint) {
23219
23422
  this.paint = paint;
23220
23423
  for (const l of this._layers) {
23221
- this._setPaint(l, paint);
23424
+ this._paint.setPaint(l, paint);
23222
23425
  }
23223
23426
  }
23224
23427
  }
@@ -23226,22 +23429,25 @@ class GeoJsonAdapter extends BaseAdapter {
23226
23429
  if (paint) {
23227
23430
  this.selectedPaint = paint;
23228
23431
  for (const l of this._selectedLayers) {
23229
- this._setPaint(l, paint);
23432
+ this._paint.setPaint(l, paint);
23230
23433
  }
23231
23434
  }
23232
23435
  }
23233
23436
  updatePaint(paint) {
23234
23437
  this.paint = { ...this.paint, ...paint };
23235
23438
  for (const l of this._layers) {
23236
- this._setPaint(l, this.paint);
23439
+ this._paint.setPaint(l, this.paint);
23237
23440
  }
23238
23441
  }
23239
23442
  updateSelectedPaint(paint) {
23240
23443
  this.selectedPaint = { ...this.selectedPaint, ...paint };
23241
23444
  for (const l of this._selectedLayers) {
23242
- this._setPaint(l, this.selectedPaint);
23445
+ this._paint.setPaint(l, this.selectedPaint);
23243
23446
  }
23244
23447
  }
23448
+ _getSelected(layer) {
23449
+ return this._selectedLayers.find((x) => x.layer === layer);
23450
+ }
23245
23451
  _updateTooltip(layerDef) {
23246
23452
  const { feature, layer } = layerDef;
23247
23453
  if (feature && layer && feature.properties && this.options.labelField) {
@@ -23331,77 +23537,6 @@ class GeoJsonAdapter extends BaseAdapter {
23331
23537
  }
23332
23538
  }
23333
23539
  }
23334
- _setPaintEachLayer(paint) {
23335
- this._layers.forEach((l) => {
23336
- this._setPaint(l, paint);
23337
- });
23338
- }
23339
- _setPaint(def, paint) {
23340
- let style = undefined;
23341
- const { layer, feature } = def;
23342
- if (layer && feature) {
23343
- if (isPaintCallback(paint)) {
23344
- style = paint(feature);
23345
- }
23346
- else if (isPaint(paint)) {
23347
- style = paint;
23348
- }
23349
- if (style) {
23350
- if (this.type === 'point' && style.type === 'icon') {
23351
- const marker = layer;
23352
- const divIcon = this._createDivIcon(style);
23353
- marker.setIcon(divIcon);
23354
- }
23355
- else if ('setStyle' in layer) {
23356
- layer.setStyle(this._preparePaint(style));
23357
- }
23358
- }
23359
- }
23360
- }
23361
- _preparePaint(paint) {
23362
- if (paint.type !== 'get-paint') {
23363
- // const path: CircleMarkerOptions | PathOptions = paint as CircleMarkerOptions | PathOptions;
23364
- // if (path.opacity) {
23365
- // path.fillOpacity = path.opacity;
23366
- // }
23367
- const paintAliases = [
23368
- // ['color', 'color'],
23369
- ['color', 'strokeColor'],
23370
- ['opacity', 'strokeOpacity'],
23371
- ['stroke', 'stroke'],
23372
- ['fillColor', 'fillColor'],
23373
- ['fillOpacity', 'fillOpacity'],
23374
- ['fill', 'fill'],
23375
- ['weight', 'weight'],
23376
- ];
23377
- const aliases = this.type === 'line'
23378
- ? [
23379
- ['color', 'strokeColor'],
23380
- ['opacity', 'strokeOpacity'],
23381
- ['weight', 'weight'],
23382
- ]
23383
- : paintAliases;
23384
- const readyPaint = {};
23385
- if ('radius' in paint && typeof paint.radius === 'number') {
23386
- readyPaint.radius = paint.radius;
23387
- }
23388
- for (const [to, from] of aliases) {
23389
- let paintProp = paint[from];
23390
- if (defined(this.options.opacity) &&
23391
- from.toLowerCase().indexOf('opacity') !== -1) {
23392
- paintProp = Number(paintProp) * this.options.opacity;
23393
- }
23394
- if (paintProp !== undefined) {
23395
- Object.defineProperty(readyPaint, to, {
23396
- enumerable: true,
23397
- value: paintProp,
23398
- });
23399
- }
23400
- }
23401
- return readyPaint;
23402
- }
23403
- return PAINT;
23404
- }
23405
23540
  _getGeoJsonOptions(options, type) {
23406
23541
  const paint = options.paint;
23407
23542
  let lopt = {};
@@ -23410,7 +23545,7 @@ class GeoJsonAdapter extends BaseAdapter {
23410
23545
  // TODO: fix types (@geoman-io/leaflet-geoman-free)
23411
23546
  lopt.pointToLayer = (feature, latLng) => {
23412
23547
  const iconOpt = paint(feature);
23413
- const pointToLayer = this._createPaintToLayer(iconOpt);
23548
+ const pointToLayer = this._paint.createPaintToLayer(iconOpt);
23414
23549
  return pointToLayer(feature, latLng);
23415
23550
  };
23416
23551
  }
@@ -23418,17 +23553,17 @@ class GeoJsonAdapter extends BaseAdapter {
23418
23553
  lopt = {
23419
23554
  style: (feature) => {
23420
23555
  if (feature) {
23421
- return this._preparePaint({ ...PAINT, ...paint(feature) });
23556
+ return this._paint.preparePaint({ ...PAINT, ...paint(feature) });
23422
23557
  }
23423
23558
  else {
23424
- return this._preparePaint({ ...PAINT, type: 'path' });
23559
+ return this._paint.preparePaint({ ...PAINT, type: 'path' });
23425
23560
  }
23426
23561
  },
23427
23562
  };
23428
23563
  }
23429
23564
  }
23430
23565
  else {
23431
- lopt = this._createPaintOptions(paint, type);
23566
+ lopt = this._paint.createPaintOptions(paint);
23432
23567
  }
23433
23568
  lopt.onEachFeature = (feature, layer) => {
23434
23569
  this._onEachFeature(feature, layer);
@@ -23444,7 +23579,6 @@ class GeoJsonAdapter extends BaseAdapter {
23444
23579
  layer,
23445
23580
  ...createFeaturePositionOptions(feature),
23446
23581
  };
23447
- // @ts-ignore
23448
23582
  layer.options.pane = this.pane;
23449
23583
  this._layers.push(def);
23450
23584
  let ok = true;
@@ -23469,7 +23603,7 @@ class GeoJsonAdapter extends BaseAdapter {
23469
23603
  layer.on('click', (e) => this._selectOnLayerClick(e), this);
23470
23604
  }
23471
23605
  }
23472
- this._handleMouseEvents(layer);
23606
+ this._events.handleMouseEvents(layer);
23473
23607
  // The timeout is needed to display the popup immediately when adding a layer to the map.
23474
23608
  // Without a timeout, the layer may not yet have a _map object
23475
23609
  setTimeout(() => {
@@ -23486,39 +23620,6 @@ class GeoJsonAdapter extends BaseAdapter {
23486
23620
  }
23487
23621
  }
23488
23622
  }
23489
- _handleMouseEvents(layer) {
23490
- const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.options;
23491
- // TODO: remove backward compatibility for onLayerClick
23492
- const onClick_ = onClick || onLayerClick;
23493
- if (onClick_) {
23494
- layer.on('click', (e) => {
23495
- const selected = !!this._getSelected(layer);
23496
- onClick_({
23497
- selected,
23498
- ...this._createMouseEvent(e),
23499
- });
23500
- }, this);
23501
- }
23502
- if (onMouseOut) {
23503
- layer.on('mouseout', (e) => {
23504
- onMouseOut(this._createMouseEvent(e));
23505
- }, this);
23506
- }
23507
- if (onMouseOver) {
23508
- layer.on('mouseover', (e) => {
23509
- onMouseOver(this._createMouseEvent(e));
23510
- }, this);
23511
- }
23512
- }
23513
- _createMouseEvent(source) {
23514
- return createMouseEvent({
23515
- layer: this,
23516
- source: source,
23517
- });
23518
- }
23519
- _getSelected(layer) {
23520
- return this._selectedLayers.find((x) => x.layer === layer);
23521
- }
23522
23623
  _selectOnLayerClick(e) {
23523
23624
  leafletSrc.exports.DomEvent.stopPropagation(e);
23524
23625
  const layer = e.target;
@@ -23552,7 +23653,7 @@ class GeoJsonAdapter extends BaseAdapter {
23552
23653
  this.selected = true;
23553
23654
  const { selectedPaint, popupOnSelect, popupOptions } = this.options;
23554
23655
  if (selectedPaint && def.layer) {
23555
- this._setPaint(def, selectedPaint);
23656
+ this._paint.setPaint(def, selectedPaint);
23556
23657
  }
23557
23658
  if (popupOnSelect) {
23558
23659
  this._openPopup(def, popupOptions, type, latlng);
@@ -23573,7 +23674,7 @@ class GeoJsonAdapter extends BaseAdapter {
23573
23674
  this._selectedLayers.splice(index, 1);
23574
23675
  if (this.options) {
23575
23676
  if (this.options.paint) {
23576
- this._setPaint(def, this.options.paint);
23677
+ this._paint.setPaint(def, this.options.paint);
23577
23678
  }
23578
23679
  if (this.options.popupOnSelect && def.layer) {
23579
23680
  this._removePopup(def.layer);
@@ -23582,50 +23683,6 @@ class GeoJsonAdapter extends BaseAdapter {
23582
23683
  }
23583
23684
  this.selected = this._selectedLayers.length > 0;
23584
23685
  }
23585
- _createDivIcon(icon) {
23586
- const { ...toLIconOpt } = icon;
23587
- return new leafletSrc.exports.DivIcon({ className: '', ...toLIconOpt });
23588
- }
23589
- _createPaintToLayer(icon) {
23590
- if (icon && icon.type) {
23591
- if (icon.type === 'icon') {
23592
- const iconClassName = icon.className;
23593
- const html = icon.html;
23594
- if (iconClassName || html) {
23595
- return (geoJsonPoint, latlng) => {
23596
- const divIcon = this._createDivIcon(icon);
23597
- return new leafletSrc.exports.Marker(latlng, { icon: divIcon });
23598
- };
23599
- }
23600
- }
23601
- else if (icon.type === 'pin') {
23602
- return (geoJsonPoint, latlng) => {
23603
- // const divIcon = this.createDivIcon(icon);
23604
- return new leafletSrc.exports.Marker(latlng);
23605
- };
23606
- }
23607
- }
23608
- return (geoJsonPoint, latlng) => {
23609
- const p = PAINT;
23610
- return new leafletSrc.exports.CircleMarker(latlng, this._preparePaint({ ...p, ...icon }));
23611
- };
23612
- }
23613
- _createPaintOptions(paintOptions, type) {
23614
- const geoJsonOptions = {};
23615
- const paint = (paintOptions && this._preparePaint(paintOptions)) || {};
23616
- if (paintOptions) {
23617
- geoJsonOptions.style = () => {
23618
- return paint;
23619
- };
23620
- }
23621
- if (type === 'point') {
23622
- geoJsonOptions.pointToLayer = this._createPaintToLayer(paintOptions);
23623
- }
23624
- else if (type === 'line') {
23625
- paint.stroke = true;
23626
- }
23627
- return geoJsonOptions;
23628
- }
23629
23686
  _addMapClickListener() {
23630
23687
  const map = this.map;
23631
23688
  if (map) {