@eeacms/volto-arcgis-block 0.1.213 → 0.1.214

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [0.1.214](https://github.com/eea/volto-arcgis-block/compare/0.1.213...0.1.214) - 5 October 2023
8
+
7
9
  ### [0.1.213](https://github.com/eea/volto-arcgis-block/compare/0.1.212...0.1.213) - 4 October 2023
8
10
 
9
11
  ### [0.1.212](https://github.com/eea/volto-arcgis-block/compare/0.1.211...0.1.212) - 4 October 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.213",
3
+ "version": "0.1.214",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -327,7 +327,14 @@ class MapViewer extends React.Component {
327
327
  renderSwipe() {
328
328
  if (this.props.mapviewer_config.Download) return;
329
329
  if (this.view)
330
- return <SwipeWidget view={this.view} mapViewer={this} map={this.map} />;
330
+ return (
331
+ <SwipeWidget
332
+ view={this.view}
333
+ mapViewer={this}
334
+ map={this.map}
335
+ layers={this.layers}
336
+ />
337
+ );
331
338
  }
332
339
 
333
340
  renderArea() {
@@ -25,7 +25,7 @@ class SwipeWidget extends React.Component {
25
25
  this.dpiMax = 1200;
26
26
  this.scaleMax = 600000000;
27
27
  this.map = this.props.map;
28
- this.visibleSavedLayers = [];
28
+ this.layers = this.props.layers;
29
29
  }
30
30
 
31
31
  loader() {
@@ -139,9 +139,6 @@ class SwipeWidget extends React.Component {
139
139
  }
140
140
  }
141
141
  renderApplySwipeButton() {
142
- if (this.visibleSavedLayers.length === 0) {
143
- this.saveVisibleLayers();
144
- }
145
142
  this.props.view.ui.remove(this.swipe);
146
143
  this.props.view.ui.add(this.swipe);
147
144
  let selectedLeadingLayer = document.getElementById('select-leading-layer')
@@ -166,23 +163,21 @@ class SwipeWidget extends React.Component {
166
163
  }
167
164
  });
168
165
  }
169
- saveVisibleLayers() {
170
- this.visibleSavedLayers.push('default');
171
- this.map.layers.forEach((layer) => {
172
- if (layer.visible) {
173
- this.visibleSavedLayers.push(layer.id);
174
- }
175
- });
176
- }
177
166
  loadVisibleLayers() {
178
- this.map.layers.forEach((layer) => {
179
- this.visibleSavedLayers.forEach((visibleLayerId) => {
180
- if (layer.id === visibleLayerId) {
181
- layer.visible = true;
167
+ let vl = JSON.parse(sessionStorage.getItem('visibleLayers'));
168
+ if (vl) {
169
+ for (const key in vl) {
170
+ if (vl[key][1] === 'eye') {
171
+ this.layers[key].visible = true;
172
+ } else {
173
+ this.layers[key].visible = false;
182
174
  }
175
+ }
176
+ } else {
177
+ this.map.layers.forEach((layer) => {
178
+ layer.visible = true;
183
179
  });
184
- });
185
- this.visibleSavedLayers = [];
180
+ }
186
181
  }
187
182
  /**
188
183
  * This method renders the component