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