@nextgis/ngw-map 1.9.4 → 1.10.0

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.9.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.10.0; author: NextGIS */
2
2
  var events = {exports: {}};
3
3
 
4
4
  var R = typeof Reflect === 'object' ? Reflect : null;
@@ -1686,7 +1686,7 @@ const OPTIONS$1 = {
1686
1686
  minZoom: 0,
1687
1687
  maxZoom: 20,
1688
1688
  paint: {
1689
- color: 'blue',
1689
+ color: '#0000ff',
1690
1690
  opacity: 0.4,
1691
1691
  strokeOpacity: 1,
1692
1692
  stroke: true,
@@ -1694,7 +1694,7 @@ const OPTIONS$1 = {
1694
1694
  weight: 1,
1695
1695
  },
1696
1696
  selectedPaint: {
1697
- color: 'darkblue',
1697
+ color: '#00008b',
1698
1698
  opacity: 0.4,
1699
1699
  strokeOpacity: 1,
1700
1700
  stroke: true,
@@ -2844,6 +2844,30 @@ class WebMapLayers extends WebMapMain {
2844
2844
  adapter.clearLayer(cb);
2845
2845
  }
2846
2846
  }
2847
+ setLayerPaint(layerDef, paint) {
2848
+ const layer = this.getLayer(layerDef);
2849
+ if (paint && layer && layer.setPaint) {
2850
+ layer.setPaint(paint);
2851
+ }
2852
+ }
2853
+ setLayerSelectedPaint(layerDef, paint) {
2854
+ const layer = this.getLayer(layerDef);
2855
+ if (paint && layer && layer.setSelectedPaint) {
2856
+ layer.setSelectedPaint(paint);
2857
+ }
2858
+ }
2859
+ updateLayerPaint(layerDef, paint) {
2860
+ const layer = this.getLayer(layerDef);
2861
+ if (paint && layer && layer.updatePaint) {
2862
+ layer.updatePaint(paint);
2863
+ }
2864
+ }
2865
+ updateLayerSelectedPaint(layerDef, paint) {
2866
+ const layer = this.getLayer(layerDef);
2867
+ if (paint && layer && layer.updateSelectedPaint) {
2868
+ layer.updateSelectedPaint(paint);
2869
+ }
2870
+ }
2847
2871
  getAttributions(options) {
2848
2872
  const attributions = [];
2849
2873
  for (const l in this._layers) {
@@ -5944,8 +5968,8 @@ class NgwWebmapItem extends Item {
5944
5968
  : undefined;
5945
5969
  const minZooms = [minZoomWebmap, minZoomLayer].filter(Boolean);
5946
5970
  const maxZooms = [maxZoomWebmap, maxZoomLayer].filter(Boolean);
5947
- const minZoom = Math.max(...minZooms);
5948
- const maxZoom = Math.min(...maxZooms);
5971
+ const minZoom = minZooms.length ? Math.max(...minZooms) : undefined;
5972
+ const maxZoom = maxZooms.length ? Math.min(...maxZooms) : undefined;
5949
5973
  return { minZoom, maxZoom };
5950
5974
  }
5951
5975
  _init(item) {
@@ -6321,7 +6345,24 @@ class NgwWebmapLayerAdapter {
6321
6345
  if (data) {
6322
6346
  this.response = data;
6323
6347
  const webmap = data[this.webmapClassName];
6324
- const webMap = this.options.webMap;
6348
+ this._setupBaselayers(data);
6349
+ if (webmap) {
6350
+ this._extent = [
6351
+ webmap.extent_left,
6352
+ webmap.extent_bottom,
6353
+ webmap.extent_right,
6354
+ webmap.extent_top,
6355
+ ];
6356
+ this._updateItemsParams(webmap.root_item, this.options.webMap, data);
6357
+ return webmap;
6358
+ }
6359
+ }
6360
+ }
6361
+ _setupBaselayers(data) {
6362
+ var _a;
6363
+ const webMap = this.options.webMap;
6364
+ const basemap = (_a = this.options.useBasemap) !== null && _a !== void 0 ? _a : true;
6365
+ if (basemap) {
6325
6366
  if (data.basemap_webmap && data.basemap_webmap.basemaps.length) {
6326
6367
  const activeBaselayer = webMap.getActiveBaseLayer();
6327
6368
  this._lastActiveBaselayer = activeBaselayer
@@ -6335,16 +6376,6 @@ class NgwWebmapLayerAdapter {
6335
6376
  name: 'OpenStreetMap',
6336
6377
  });
6337
6378
  }
6338
- if (webmap) {
6339
- this._extent = [
6340
- webmap.extent_left,
6341
- webmap.extent_bottom,
6342
- webmap.extent_right,
6343
- webmap.extent_top,
6344
- ];
6345
- this._updateItemsParams(webmap.root_item, this.options.webMap, data);
6346
- return webmap;
6347
- }
6348
6379
  }
6349
6380
  }
6350
6381
  _setBasemaps(baseWebmap) {
@@ -7264,10 +7295,10 @@ function prepareWebMapOptions(options) {
7264
7295
  options.baseUrl = options.connector.options.baseUrl;
7265
7296
  }
7266
7297
  options = deepmerge(OPTIONS, options);
7267
- // if (!options.center && !options.bounds) {
7268
- // options.bounds = [-179, -90, 180, 90];
7269
- // options.maxBounds = options.bounds;
7270
- // }
7298
+ if (!options.center && !options.bounds) {
7299
+ options.bounds = [-179, -90, 180, 90];
7300
+ // options.maxBounds = options.bounds;
7301
+ }
7271
7302
  if (options.connector) {
7272
7303
  kits.push(new NgwKit({
7273
7304
  connector: options.connector,