@eeacms/volto-arcgis-block 0.1.153 → 0.1.155
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 +7 -0
- package/package.json +1 -1
- package/src/components/MapViewer/AreaWidget.jsx +4 -1
- package/src/components/MapViewer/LegendWidget.jsx +25 -2
- package/src/components/MapViewer/MapViewer.jsx +15 -1
- package/src/components/MapViewer/PanWidget.jsx +136 -0
- package/src/components/MapViewer/css/ArcgisMap.css +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ 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.155](https://github.com/eea/volto-arcgis-block/compare/0.1.154...0.1.155) - 7 June 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-2107 - Fix PanWidget.jsx [Víctor Miguélez Blanco - [`06f1263`](https://github.com/eea/volto-arcgis-block/commit/06f12630f3e3c54ec37408c28b27f6ed503c9bac)]
|
|
12
|
+
### [0.1.154](https://github.com/eea/volto-arcgis-block/compare/0.1.153...0.1.154) - 5 June 2023
|
|
13
|
+
|
|
7
14
|
### [0.1.153](https://github.com/eea/volto-arcgis-block/compare/0.1.152...0.1.153) - 30 May 2023
|
|
8
15
|
|
|
9
16
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -166,6 +166,7 @@ class AreaWidget extends React.Component {
|
|
|
166
166
|
}
|
|
167
167
|
rectanglehandler() {
|
|
168
168
|
this.clearWidget();
|
|
169
|
+
window.document.querySelector('.pan-container').style.display = 'flex';
|
|
169
170
|
var fillSymbol = {
|
|
170
171
|
type: 'simple-fill',
|
|
171
172
|
color: [255, 255, 255, 0.5],
|
|
@@ -178,6 +179,7 @@ class AreaWidget extends React.Component {
|
|
|
178
179
|
let extentGraphic = null;
|
|
179
180
|
let origin = null;
|
|
180
181
|
const drawGraphics = this.props.view.on('drag', (e) => {
|
|
182
|
+
if (this.props.mapViewer.pan_enabled) return;
|
|
181
183
|
e.stopPropagation();
|
|
182
184
|
if (e.action === 'start') {
|
|
183
185
|
if (extentGraphic) this.props.view.graphics.remove(extentGraphic);
|
|
@@ -215,6 +217,7 @@ class AreaWidget extends React.Component {
|
|
|
215
217
|
});
|
|
216
218
|
}
|
|
217
219
|
clearWidget() {
|
|
220
|
+
window.document.querySelector('.pan-container').style.display = 'none';
|
|
218
221
|
this.props.mapViewer.view.popup.close();
|
|
219
222
|
if (this.state.ShowGraphics) {
|
|
220
223
|
this.state.ShowGraphics.remove();
|
|
@@ -443,7 +446,7 @@ class AreaWidget extends React.Component {
|
|
|
443
446
|
</div>
|
|
444
447
|
</div>
|
|
445
448
|
{!this.props.download && this.state.showInfoPopup && (
|
|
446
|
-
<div className="map-container">
|
|
449
|
+
<div className="map-container popup-block">
|
|
447
450
|
<div className="drawRectanglePopup-block">
|
|
448
451
|
<div className="drawRectanglePopup-content">
|
|
449
452
|
{this.state.infoPopupType === 'area' && (
|
|
@@ -23,6 +23,27 @@ class LegendWidget extends React.Component {
|
|
|
23
23
|
'esri-icon-legend esri-widget--button esri-widget esri-interactive';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
hideNutsLegend() {
|
|
27
|
+
//debugger;
|
|
28
|
+
const collection = document.getElementsByClassName('esri-legend__symbol');
|
|
29
|
+
|
|
30
|
+
Array.prototype.forEach.call(collection, (element) => {
|
|
31
|
+
let img = {};
|
|
32
|
+
|
|
33
|
+
if (element.hasChildNodes()) img = element.childNodes[0];
|
|
34
|
+
else img = element;
|
|
35
|
+
|
|
36
|
+
//if img is type of svg
|
|
37
|
+
if (img?.children?.[0]?.localName?.includes('svg') ?? false) {
|
|
38
|
+
img.closest(
|
|
39
|
+
'.esri-legend__service.esri-legend__group-layer',
|
|
40
|
+
).style.display = 'none';
|
|
41
|
+
//img.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.firstElementChild.style.display = 'none';
|
|
42
|
+
//img.style.display = 'none';
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
26
47
|
brokenLegendImagePatch() {
|
|
27
48
|
const collection = document.getElementsByClassName('esri-legend__symbol');
|
|
28
49
|
|
|
@@ -32,8 +53,8 @@ class LegendWidget extends React.Component {
|
|
|
32
53
|
if (element.hasChildNodes()) img = element.childNodes[0];
|
|
33
54
|
else img = element;
|
|
34
55
|
|
|
35
|
-
// If img src returns a broken link
|
|
36
56
|
if (!(img.complete && img.naturalHeight !== 0)) {
|
|
57
|
+
// If img src returns a broken link
|
|
37
58
|
if (img?.src?.includes('all_present_lc_a_pol')) {
|
|
38
59
|
//img.src =
|
|
39
60
|
// 'https://clmsdemo.devel6cph.eea.europa.eu/en/products/lclcc-hot-spots/static-legends/dichotomous-reference-land-cover.png/@@images/image-283-df1c7b022cfd505c9bab4b4be08cd4f5.png';
|
|
@@ -158,10 +179,12 @@ class LegendWidget extends React.Component {
|
|
|
158
179
|
}),
|
|
159
180
|
container: document.querySelector('.legend-panel'),
|
|
160
181
|
});
|
|
161
|
-
|
|
162
182
|
this.props.view.allLayerViews.watch('length', () => {
|
|
163
183
|
setTimeout(() => {
|
|
164
184
|
this.brokenLegendImagePatch();
|
|
185
|
+
if (this.props.download) {
|
|
186
|
+
this.hideNutsLegend();
|
|
187
|
+
}
|
|
165
188
|
}, 1000);
|
|
166
189
|
});
|
|
167
190
|
}
|
|
@@ -17,6 +17,7 @@ import LegendWidget from './LegendWidget';
|
|
|
17
17
|
import InfoWidget from './InfoWidget';
|
|
18
18
|
import MenuWidget from './MenuWidget';
|
|
19
19
|
import HotspotWidget from './HotspotWidget';
|
|
20
|
+
import PanWidget from './PanWidget';
|
|
20
21
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
21
22
|
var Map, MapView, Zoom, intl, Basemap, WebTileLayer, Extent;
|
|
22
23
|
let mapStatus = {};
|
|
@@ -262,7 +263,14 @@ class MapViewer extends React.Component {
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
renderLegend() {
|
|
265
|
-
if (this.view)
|
|
266
|
+
if (this.view)
|
|
267
|
+
return (
|
|
268
|
+
<LegendWidget
|
|
269
|
+
view={this.view}
|
|
270
|
+
mapViewer={this}
|
|
271
|
+
download={this.props.mapviewer_config.Download}
|
|
272
|
+
/>
|
|
273
|
+
);
|
|
266
274
|
}
|
|
267
275
|
|
|
268
276
|
renderMeasurement() {
|
|
@@ -292,6 +300,11 @@ class MapViewer extends React.Component {
|
|
|
292
300
|
return <InfoWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
293
301
|
}
|
|
294
302
|
|
|
303
|
+
renderPan() {
|
|
304
|
+
if (this.view)
|
|
305
|
+
return <PanWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
306
|
+
}
|
|
307
|
+
|
|
295
308
|
renderHotspot() {
|
|
296
309
|
if (this.view)
|
|
297
310
|
return (
|
|
@@ -350,6 +363,7 @@ class MapViewer extends React.Component {
|
|
|
350
363
|
{this.renderMeasurement()}
|
|
351
364
|
{this.renderPrint()}
|
|
352
365
|
{this.renderArea()}
|
|
366
|
+
{this.renderPan()}
|
|
353
367
|
{this.renderScale()}
|
|
354
368
|
{this.renderInfo()}
|
|
355
369
|
{this.renderHotspot()}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React, { createRef } from 'react';
|
|
2
|
+
|
|
3
|
+
class PanWidget extends React.Component {
|
|
4
|
+
/**
|
|
5
|
+
* Creator of the Basemap widget class
|
|
6
|
+
* @param {*} props
|
|
7
|
+
*/
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
//We create a reference to a DOM element to be mounted
|
|
11
|
+
this.container = createRef();
|
|
12
|
+
//Initially, we set the state of the component to
|
|
13
|
+
//not be showing the basemap panel
|
|
14
|
+
this.state = {};
|
|
15
|
+
this.PIXELS_TO_PAN = 50;
|
|
16
|
+
this.props.mapViewer.pan_enabled = false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This method is executed after the rener method is executed
|
|
21
|
+
*/
|
|
22
|
+
async componentDidMount() {
|
|
23
|
+
this.props.view.ui.add({
|
|
24
|
+
component: this.container.current,
|
|
25
|
+
position: 'top-right',
|
|
26
|
+
index: 0,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
togglePan() {
|
|
31
|
+
this.props.mapViewer.pan_enabled = !this.props.mapViewer.pan_enabled;
|
|
32
|
+
let pan_toogle_button = window.document.querySelector(
|
|
33
|
+
'#pan_toogle_button>span',
|
|
34
|
+
);
|
|
35
|
+
if (this.props.mapViewer.pan_enabled) {
|
|
36
|
+
pan_toogle_button.classList.add('active-widget');
|
|
37
|
+
} else {
|
|
38
|
+
pan_toogle_button.classList.remove('active-widget');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async moveUp() {
|
|
42
|
+
let center = this.props.mapViewer.view.center;
|
|
43
|
+
let resolution = this.props.mapViewer.view.resolution;
|
|
44
|
+
center.y += resolution * this.PIXELS_TO_PAN;
|
|
45
|
+
await this.props.mapViewer.view.goTo({ target: center });
|
|
46
|
+
}
|
|
47
|
+
async moveDown() {
|
|
48
|
+
let center = this.props.mapViewer.view.center;
|
|
49
|
+
let resolution = this.props.mapViewer.view.resolution;
|
|
50
|
+
center.y -= resolution * this.PIXELS_TO_PAN;
|
|
51
|
+
await this.props.mapViewer.view.goTo({ target: center });
|
|
52
|
+
}
|
|
53
|
+
async moveLeft() {
|
|
54
|
+
let center = this.props.mapViewer.view.center;
|
|
55
|
+
let resolution = this.props.mapViewer.view.resolution;
|
|
56
|
+
center.x -= resolution * this.PIXELS_TO_PAN;
|
|
57
|
+
await this.props.mapViewer.view.goTo({ target: center });
|
|
58
|
+
}
|
|
59
|
+
async moveRight() {
|
|
60
|
+
let center = this.props.mapViewer.view.center;
|
|
61
|
+
let resolution = this.props.mapViewer.view.resolution;
|
|
62
|
+
center.x += resolution * this.PIXELS_TO_PAN;
|
|
63
|
+
await this.props.mapViewer.view.goTo({ target: center });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* This method renders the component
|
|
68
|
+
* @returns jsx
|
|
69
|
+
*/
|
|
70
|
+
render() {
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<div ref={this.container} className="pan-container">
|
|
74
|
+
<div>
|
|
75
|
+
<div
|
|
76
|
+
id="pan_left_button"
|
|
77
|
+
className="esri-icon-left-arrow-circled esri-widget--button"
|
|
78
|
+
role="button"
|
|
79
|
+
tabIndex="0"
|
|
80
|
+
onClick={this.moveLeft.bind(this)}
|
|
81
|
+
onKeyDown={this.moveLeft.bind(this)}
|
|
82
|
+
></div>
|
|
83
|
+
</div>
|
|
84
|
+
<div>
|
|
85
|
+
<div
|
|
86
|
+
id="pan_up_button"
|
|
87
|
+
className="esri-icon-up-arrow-circled esri-widget--button"
|
|
88
|
+
role="button"
|
|
89
|
+
tabIndex="0"
|
|
90
|
+
onClick={this.moveUp.bind(this)}
|
|
91
|
+
onKeyDown={this.moveUp.bind(this)}
|
|
92
|
+
></div>
|
|
93
|
+
<div
|
|
94
|
+
id="pan_toogle_button"
|
|
95
|
+
className="esri-widget--button esri-widget esri-interactive"
|
|
96
|
+
role="button"
|
|
97
|
+
tabIndex="0"
|
|
98
|
+
aria-label="Toogle pan"
|
|
99
|
+
tooltip="Toogle pan"
|
|
100
|
+
direction="left"
|
|
101
|
+
type="widget"
|
|
102
|
+
onClick={this.togglePan.bind(this)}
|
|
103
|
+
onKeyDown={this.togglePan.bind(this)}
|
|
104
|
+
>
|
|
105
|
+
<span
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
role="presentation"
|
|
108
|
+
class="esri-widget--button esri-icon esri-icon-pan"
|
|
109
|
+
></span>
|
|
110
|
+
</div>
|
|
111
|
+
<div
|
|
112
|
+
id="pan_down_button"
|
|
113
|
+
className="esri-icon-down-arrow-circled esri-widget--button"
|
|
114
|
+
role="button"
|
|
115
|
+
tabIndex="0"
|
|
116
|
+
onClick={this.moveDown.bind(this)}
|
|
117
|
+
onKeyDown={this.moveDown.bind(this)}
|
|
118
|
+
></div>
|
|
119
|
+
</div>
|
|
120
|
+
<div>
|
|
121
|
+
<div
|
|
122
|
+
id="pan_right_button"
|
|
123
|
+
className="esri-icon-right-arrow-circled esri-widget--button"
|
|
124
|
+
role="button"
|
|
125
|
+
tabIndex="0"
|
|
126
|
+
onClick={this.moveRight.bind(this)}
|
|
127
|
+
onKeyDown={this.moveRight.bind(this)}
|
|
128
|
+
></div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default PanWidget;
|
|
@@ -1263,8 +1263,19 @@ input[type='range']::-ms-track {
|
|
|
1263
1263
|
font-size: 0.875rem;
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
-
.
|
|
1267
|
-
|
|
1266
|
+
div.map-container.popup-block {
|
|
1267
|
+
position: absolute;
|
|
1268
|
+
top: 0px;
|
|
1269
|
+
left: -34vw;
|
|
1270
|
+
height: auto;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
.esri-ui-corner .esri-component.pan-container {
|
|
1274
|
+
display: none;
|
|
1275
|
+
flex-direction: row;
|
|
1276
|
+
align-items: center;
|
|
1277
|
+
margin-left: -72px;
|
|
1278
|
+
box-shadow: none;
|
|
1268
1279
|
}
|
|
1269
1280
|
|
|
1270
1281
|
.esri-component.drawRectanglePopup-block {
|