@nextgis/ngw-map 1.16.4 → 1.16.5

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-map; version: 1.16.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.16.5; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -838,8 +838,9 @@ var NgwMap = (function (exports) {
838
838
  if (er instanceof _this.CancelError) {
839
839
  for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
840
840
  var v = values_1[_i];
841
- if ('cancel' in v) {
842
- v.cancel();
841
+ var v_ = v;
842
+ if ('cancel' in v_) {
843
+ v_.cancel();
843
844
  }
844
845
  }
845
846
  }
@@ -2969,7 +2970,7 @@ var NgwMap = (function (exports) {
2969
2970
  }
2970
2971
  });
2971
2972
  }); };
2972
- if (layer && layer.options.visibility !== toStatus) {
2973
+ if (layer) {
2973
2974
  return this.onMapLoad().then(function () { return action(layer); });
2974
2975
  }
2975
2976
  return Promise.resolve();
@@ -3095,20 +3096,21 @@ var NgwMap = (function (exports) {
3095
3096
  };
3096
3097
  WebMapLayers.prototype.propertiesFilter = function (layerDef, filters, options) {
3097
3098
  var layer = this.getLayer(layerDef);
3098
- if (!layer)
3099
- return;
3100
- var adapter = layer;
3101
- if (adapter.propertiesFilter) {
3102
- adapter.propertiesFilter(filters, options);
3103
- }
3104
- else if (adapter.filter) {
3105
- this.filterLayer(adapter, function (e) {
3106
- if (e.feature && e.feature.properties) {
3107
- return propertiesFilter(e.feature.properties, filters);
3108
- }
3109
- return true;
3110
- });
3099
+ if (layer) {
3100
+ var adapter = layer;
3101
+ if (adapter.propertiesFilter) {
3102
+ return adapter.propertiesFilter(filters, options);
3103
+ }
3104
+ else if (adapter.filter) {
3105
+ this.filterLayer(adapter, function (e) {
3106
+ if (e.feature && e.feature.properties) {
3107
+ return propertiesFilter(e.feature.properties, filters);
3108
+ }
3109
+ return true;
3110
+ });
3111
+ }
3111
3112
  }
3113
+ return Promise.resolve();
3112
3114
  };
3113
3115
  WebMapLayers.prototype.removeLayerFilter = function (layerDef) {
3114
3116
  var layer = this.getLayer(layerDef);
@@ -7802,7 +7804,7 @@ var NgwMap = (function (exports) {
7802
7804
  extent: bbox,
7803
7805
  size: width + ',' + height,
7804
7806
  timestamp: Date.now(),
7805
- nd: nd,
7807
+ nd: nd !== null && nd !== void 0 ? nd : 200,
7806
7808
  };
7807
7809
  }
7808
7810
  var vectorLayerGeomToPaintTypeAlias = {
@@ -8240,28 +8242,32 @@ var NgwMap = (function (exports) {
8240
8242
  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"/>',
8241
8243
  };
8242
8244
  var STROKE = 0.8;
8243
- function insertSvg(width, height, stroke, content) {
8245
+ function generateSvg(width, height, stroke, content) {
8244
8246
  if (stroke === void 0) { stroke = 0; }
8245
8247
  var s = stroke / 2;
8246
8248
  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>");
8249
+ return svg;
8250
+ }
8251
+ function insertSvg(svg) {
8247
8252
  var oParser = new DOMParser();
8248
8253
  var oDOM = oParser.parseFromString(svg, 'image/svg+xml');
8249
8254
  return oDOM.documentElement;
8250
8255
  }
8251
8256
  function getIcon(opt) {
8257
+ var _a, _b, _c, _d;
8252
8258
  if (opt === void 0) { opt = {}; }
8253
8259
  // default values
8254
- var shape = opt.shape || 'circle';
8255
- var color = opt.color || 'blue';
8256
- var strokeColor = opt.strokeColor || 'white';
8257
- var size = opt.size || 12;
8260
+ var shape = (_a = opt.shape) !== null && _a !== void 0 ? _a : 'circle';
8261
+ var color = (_b = opt.color) !== null && _b !== void 0 ? _b : 'blue';
8262
+ var strokeColor = (_c = opt.strokeColor) !== null && _c !== void 0 ? _c : 'white';
8263
+ var size = (_d = opt.size) !== null && _d !== void 0 ? _d : 12;
8258
8264
  var anchor = size / 2;
8259
8265
  var defSize = 12;
8260
8266
  var stroke = typeof opt.stroke === 'number' ? opt.stroke : STROKE;
8261
8267
  var scale = size / defSize;
8262
- var pathAlias = svgPath[shape] || 'circle';
8268
+ var pathAlias = opt.p || svgPath[shape] || 'circle';
8263
8269
  var path = typeof pathAlias === 'string' ? pathAlias : pathAlias(opt);
8264
- var svg = insertSvg(size, size, stroke * scale, path);
8270
+ var svg = insertSvg(opt.svg || generateSvg(size, size, stroke * scale, path));
8265
8271
  var fistChild = svg.firstChild;
8266
8272
  var transform = "scale(".concat(scale, ")");
8267
8273
  fistChild.setAttribute('fill', color);
@@ -8645,7 +8651,10 @@ var NgwMap = (function (exports) {
8645
8651
  _a.label = 5;
8646
8652
  case 5:
8647
8653
  if (item) {
8648
- fetchNgwResourceExtent(item, this.connector).then(function (extent) {
8654
+ fetchNgwExtent({
8655
+ resourceId: item.resource.id,
8656
+ connector: this.connector,
8657
+ }).then(function (extent) {
8649
8658
  if (extent) {
8650
8659
  _this.fitBounds(extent, options);
8651
8660
  }
@@ -8654,7 +8663,7 @@ var NgwMap = (function (exports) {
8654
8663
  _a.label = 6;
8655
8664
  case 6: return [3 /*break*/, 8];
8656
8665
  case 7:
8657
- _super.prototype.fitLayer.call(this, layerDef, options);
8666
+ _super.prototype.fitLayer.call(this, typeof layerDef === 'number' ? String(layerDef) : layerDef, options);
8658
8667
  _a.label = 8;
8659
8668
  case 8: return [2 /*return*/];
8660
8669
  }