@nextgis/ngw-leaflet 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-leaflet; version: 1.9.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.10.0; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.9.4; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.10.0; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15950,7 +15950,7 @@ var NgwLeaflet = (function () {
15950
15950
  minZoom: 0,
15951
15951
  maxZoom: 20,
15952
15952
  paint: {
15953
- color: 'blue',
15953
+ color: '#0000ff',
15954
15954
  opacity: 0.4,
15955
15955
  strokeOpacity: 1,
15956
15956
  stroke: true,
@@ -15958,7 +15958,7 @@ var NgwLeaflet = (function () {
15958
15958
  weight: 1,
15959
15959
  },
15960
15960
  selectedPaint: {
15961
- color: 'darkblue',
15961
+ color: '#00008b',
15962
15962
  opacity: 0.4,
15963
15963
  strokeOpacity: 1,
15964
15964
  stroke: true,
@@ -17234,6 +17234,30 @@ var NgwLeaflet = (function () {
17234
17234
  adapter.clearLayer(cb);
17235
17235
  }
17236
17236
  };
17237
+ WebMapLayers.prototype.setLayerPaint = function (layerDef, paint) {
17238
+ var layer = this.getLayer(layerDef);
17239
+ if (paint && layer && layer.setPaint) {
17240
+ layer.setPaint(paint);
17241
+ }
17242
+ };
17243
+ WebMapLayers.prototype.setLayerSelectedPaint = function (layerDef, paint) {
17244
+ var layer = this.getLayer(layerDef);
17245
+ if (paint && layer && layer.setSelectedPaint) {
17246
+ layer.setSelectedPaint(paint);
17247
+ }
17248
+ };
17249
+ WebMapLayers.prototype.updateLayerPaint = function (layerDef, paint) {
17250
+ var layer = this.getLayer(layerDef);
17251
+ if (paint && layer && layer.updatePaint) {
17252
+ layer.updatePaint(paint);
17253
+ }
17254
+ };
17255
+ WebMapLayers.prototype.updateLayerSelectedPaint = function (layerDef, paint) {
17256
+ var layer = this.getLayer(layerDef);
17257
+ if (paint && layer && layer.updateSelectedPaint) {
17258
+ layer.updateSelectedPaint(paint);
17259
+ }
17260
+ };
17237
17261
  WebMapLayers.prototype.getAttributions = function (options) {
17238
17262
  var attributions = [];
17239
17263
  for (var l in this._layers) {
@@ -20604,8 +20628,8 @@ var NgwLeaflet = (function () {
20604
20628
  : undefined;
20605
20629
  var minZooms = [minZoomWebmap, minZoomLayer].filter(Boolean);
20606
20630
  var maxZooms = [maxZoomWebmap, maxZoomLayer].filter(Boolean);
20607
- var minZoom = Math.max.apply(Math, minZooms);
20608
- var maxZoom = Math.min.apply(Math, maxZooms);
20631
+ var minZoom = minZooms.length ? Math.max.apply(Math, minZooms) : undefined;
20632
+ var maxZoom = maxZooms.length ? Math.min.apply(Math, maxZooms) : undefined;
20609
20633
  return { minZoom: minZoom, maxZoom: maxZoom };
20610
20634
  };
20611
20635
  NgwWebmapItem.prototype._init = function (item) {
@@ -21098,7 +21122,7 @@ var NgwLeaflet = (function () {
21098
21122
  };
21099
21123
  NgwWebmapLayerAdapter.prototype.getWebMapConfig = function (id) {
21100
21124
  return __awaiter(this, void 0, void 0, function () {
21101
- var data, webmap, webMap, activeBaselayer;
21125
+ var data, webmap;
21102
21126
  return __generator(this, function (_a) {
21103
21127
  switch (_a.label) {
21104
21128
  case 0: return [4 /*yield*/, this.options.connector.getResource(id)];
@@ -21107,20 +21131,7 @@ var NgwLeaflet = (function () {
21107
21131
  if (data) {
21108
21132
  this.response = data;
21109
21133
  webmap = data[this.webmapClassName];
21110
- webMap = this.options.webMap;
21111
- if (data.basemap_webmap && data.basemap_webmap.basemaps.length) {
21112
- activeBaselayer = webMap.getActiveBaseLayer();
21113
- this._lastActiveBaselayer = activeBaselayer
21114
- ? activeBaselayer.id
21115
- : undefined;
21116
- this._setBasemaps(data.basemap_webmap);
21117
- }
21118
- else if (this.options.defaultBasemap) {
21119
- webMap.addBaseLayer('OSM', {
21120
- id: 'webmap-default-baselayer',
21121
- name: 'OpenStreetMap',
21122
- });
21123
- }
21134
+ this._setupBaselayers(data);
21124
21135
  if (webmap) {
21125
21136
  this._extent = [
21126
21137
  webmap.extent_left,
@@ -21137,6 +21148,26 @@ var NgwLeaflet = (function () {
21137
21148
  });
21138
21149
  });
21139
21150
  };
21151
+ NgwWebmapLayerAdapter.prototype._setupBaselayers = function (data) {
21152
+ var _a;
21153
+ var webMap = this.options.webMap;
21154
+ var basemap = (_a = this.options.useBasemap) !== null && _a !== void 0 ? _a : true;
21155
+ if (basemap) {
21156
+ if (data.basemap_webmap && data.basemap_webmap.basemaps.length) {
21157
+ var activeBaselayer = webMap.getActiveBaseLayer();
21158
+ this._lastActiveBaselayer = activeBaselayer
21159
+ ? activeBaselayer.id
21160
+ : undefined;
21161
+ this._setBasemaps(data.basemap_webmap);
21162
+ }
21163
+ else if (this.options.defaultBasemap) {
21164
+ webMap.addBaseLayer('OSM', {
21165
+ id: 'webmap-default-baselayer',
21166
+ name: 'OpenStreetMap',
21167
+ });
21168
+ }
21169
+ }
21170
+ };
21140
21171
  NgwWebmapLayerAdapter.prototype._setBasemaps = function (baseWebmap) {
21141
21172
  var _this = this;
21142
21173
  var webMap = this.options.webMap;
@@ -22150,10 +22181,10 @@ var NgwLeaflet = (function () {
22150
22181
  options.baseUrl = options.connector.options.baseUrl;
22151
22182
  }
22152
22183
  options = deepmerge(OPTIONS, options);
22153
- // if (!options.center && !options.bounds) {
22154
- // options.bounds = [-179, -90, 180, 90];
22155
- // options.maxBounds = options.bounds;
22156
- // }
22184
+ if (!options.center && !options.bounds) {
22185
+ options.bounds = [-179, -90, 180, 90];
22186
+ // options.maxBounds = options.bounds;
22187
+ }
22157
22188
  if (options.connector) {
22158
22189
  kits.push(new NgwKit({
22159
22190
  connector: options.connector,
@@ -22840,6 +22871,9 @@ var NgwLeaflet = (function () {
22840
22871
  if (options.bar) {
22841
22872
  element.classList.add('leaflet-bar');
22842
22873
  }
22874
+ if (options.addClass) {
22875
+ element.classList.add(options.addClass);
22876
+ }
22843
22877
  if (!options.margin && !options.bar) {
22844
22878
  element.style.marginBottom = '0px';
22845
22879
  element.style.marginTop = '0px';