@eeacms/volto-arcgis-block 0.1.212 → 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,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.214](https://github.com/eea/volto-arcgis-block/compare/0.1.213...0.1.214) - 5 October 2023
8
+
9
+ ### [0.1.213](https://github.com/eea/volto-arcgis-block/compare/0.1.212...0.1.213) - 4 October 2023
10
+
7
11
  ### [0.1.212](https://github.com/eea/volto-arcgis-block/compare/0.1.211...0.1.212) - 4 October 2023
8
12
 
9
13
  ### [0.1.211](https://github.com/eea/volto-arcgis-block/compare/0.1.210...0.1.211) - 4 October 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.212",
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() {
@@ -88,13 +88,13 @@ class SwipeWidget extends React.Component {
88
88
  await this.loader();
89
89
  this.swipe = new Swipe({
90
90
  view: this.props.view,
91
+ direction: 'horizontal',
91
92
  position: 50,
92
93
  });
93
94
  }
94
-
95
95
  getLayerTitle(layer) {
96
96
  let title;
97
- if (layer.url.toLowerCase().includes('wmts')) {
97
+ if (layer.url && layer.url.toLowerCase().includes('wmts')) {
98
98
  title = layer._wmtsTitle;
99
99
  } else {
100
100
  if (layer.sublayers) {
@@ -139,17 +139,18 @@ 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')
148
145
  .value;
149
146
  let selectedTrailingLayer = document.getElementById('select-trailing-layer')
150
147
  .value;
148
+ let selectedSwipeDirection = document.getElementById(
149
+ 'select-swipe-direction',
150
+ ).value;
151
151
  this.swipe.leadingLayers.removeAll();
152
152
  this.swipe.trailingLayers.removeAll();
153
+ this.swipe.direction = selectedSwipeDirection;
153
154
  this.map.layers.forEach((layer) => {
154
155
  layer.visible = false;
155
156
  if (layer.id === selectedLeadingLayer) {
@@ -162,23 +163,21 @@ class SwipeWidget extends React.Component {
162
163
  }
163
164
  });
164
165
  }
165
- saveVisibleLayers() {
166
- this.visibleSavedLayers.push('default');
167
- this.map.layers.forEach((layer) => {
168
- if (layer.visible) {
169
- this.visibleSavedLayers.push(layer.id);
170
- }
171
- });
172
- }
173
166
  loadVisibleLayers() {
174
- this.map.layers.forEach((layer) => {
175
- this.visibleSavedLayers.forEach((visibleLayerId) => {
176
- if (layer.id === visibleLayerId) {
177
- 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;
178
174
  }
175
+ }
176
+ } else {
177
+ this.map.layers.forEach((layer) => {
178
+ layer.visible = true;
179
179
  });
180
- });
181
- this.visibleSavedLayers = [];
180
+ }
182
181
  }
183
182
  /**
184
183
  * This method renders the component
@@ -219,6 +218,12 @@ class SwipeWidget extends React.Component {
219
218
  <span>Trailing Layer</span>
220
219
  <select id="select-trailing-layer" class="esri-select"></select>
221
220
  <br></br>
221
+ <span>Swipe Direction</span>
222
+ <select id="select-swipe-direction" class="esri-select">
223
+ <option value="horizontal">Horizontal</option>
224
+ <option value="vertical">Vertical</option>
225
+ </select>
226
+ <br></br>
222
227
  <button
223
228
  id="applySwipeButton"
224
229
  class="esri-button"