@eeacms/volto-arcgis-block 0.1.213 → 0.1.215

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,10 @@ 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.215](https://github.com/eea/volto-arcgis-block/compare/0.1.214...0.1.215) - 9 October 2023
8
+
9
+ ### [0.1.214](https://github.com/eea/volto-arcgis-block/compare/0.1.213...0.1.214) - 5 October 2023
10
+
7
11
  ### [0.1.213](https://github.com/eea/volto-arcgis-block/compare/0.1.212...0.1.213) - 4 October 2023
8
12
 
9
13
  ### [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.215",
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')
@@ -154,35 +151,51 @@ class SwipeWidget extends React.Component {
154
151
  this.swipe.leadingLayers.removeAll();
155
152
  this.swipe.trailingLayers.removeAll();
156
153
  this.swipe.direction = selectedSwipeDirection;
154
+ let vl = JSON.parse(sessionStorage.getItem('visibleLayers'));
157
155
  this.map.layers.forEach((layer) => {
158
156
  layer.visible = false;
159
157
  if (layer.id === selectedLeadingLayer) {
160
158
  layer.visible = true;
159
+ if (vl) {
160
+ for (const key in vl) {
161
+ if (this.layers[key].id === layer.id) {
162
+ if (vl[key][1] === 'eye-slash') {
163
+ layer.visible = false;
164
+ }
165
+ }
166
+ }
167
+ }
161
168
  this.swipe.leadingLayers.add(layer);
162
169
  }
163
170
  if (layer.id === selectedTrailingLayer) {
164
171
  layer.visible = true;
172
+ if (vl) {
173
+ for (const key in vl) {
174
+ if (this.layers[key].id === layer.id) {
175
+ if (vl[key][1] === 'eye-slash') {
176
+ layer.visible = false;
177
+ }
178
+ }
179
+ }
180
+ }
165
181
  this.swipe.trailingLayers.add(layer);
166
182
  }
167
183
  });
168
184
  }
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
185
  loadVisibleLayers() {
186
+ let vl = JSON.parse(sessionStorage.getItem('visibleLayers'));
178
187
  this.map.layers.forEach((layer) => {
179
- this.visibleSavedLayers.forEach((visibleLayerId) => {
180
- if (layer.id === visibleLayerId) {
181
- layer.visible = true;
188
+ layer.visible = true;
189
+ if (vl) {
190
+ for (const key in vl) {
191
+ if (this.layers[key].id === layer.id) {
192
+ if (vl[key][1] === 'eye-slash') {
193
+ layer.visible = false;
194
+ }
195
+ }
182
196
  }
183
- });
197
+ }
184
198
  });
185
- this.visibleSavedLayers = [];
186
199
  }
187
200
  /**
188
201
  * This method renders the component