@eeacms/volto-arcgis-block 0.1.154 → 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
CHANGED
|
@@ -4,6 +4,11 @@ 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)]
|
|
7
12
|
### [0.1.154](https://github.com/eea/volto-arcgis-block/compare/0.1.153...0.1.154) - 5 June 2023
|
|
8
13
|
|
|
9
14
|
### [0.1.153](https://github.com/eea/volto-arcgis-block/compare/0.1.152...0.1.153) - 30 May 2023
|
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' && (
|
|
@@ -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 = {};
|
|
@@ -299,6 +300,11 @@ class MapViewer extends React.Component {
|
|
|
299
300
|
return <InfoWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
300
301
|
}
|
|
301
302
|
|
|
303
|
+
renderPan() {
|
|
304
|
+
if (this.view)
|
|
305
|
+
return <PanWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
306
|
+
}
|
|
307
|
+
|
|
302
308
|
renderHotspot() {
|
|
303
309
|
if (this.view)
|
|
304
310
|
return (
|
|
@@ -357,6 +363,7 @@ class MapViewer extends React.Component {
|
|
|
357
363
|
{this.renderMeasurement()}
|
|
358
364
|
{this.renderPrint()}
|
|
359
365
|
{this.renderArea()}
|
|
366
|
+
{this.renderPan()}
|
|
360
367
|
{this.renderScale()}
|
|
361
368
|
{this.renderInfo()}
|
|
362
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 {
|