@@ -18,16 +18,27 @@ import minusIcon from 'assets/icons/minus.svg';
18
18
import shareIcon from 'assets/icons/share.svg' ;
19
19
import fullscreenIcon from 'assets/icons/fit-zoom.svg' ;
20
20
import printIcon from 'assets/icons/print.svg' ;
21
+ import helpIocn from 'assets/icons/help.svg' ;
21
22
import globeIcon from 'assets/icons/globe.svg' ;
22
23
import satelliteIcon from 'assets/icons/satellite.svg' ;
23
24
24
25
import './map-controls-styles.scss' ;
25
26
26
27
class MapControlsButtons extends PureComponent {
27
28
state = {
28
- showBasemaps : false
29
+ pulseTourBtn : false
29
30
} ;
30
31
32
+ componentDidUpdate ( prevProps ) {
33
+ const { mapTourOpen } = this . props ;
34
+ if ( ! mapTourOpen && mapTourOpen !== prevProps . mapTourOpen ) {
35
+ this . setPulseTourBtn ( true ) ;
36
+ setTimeout ( ( ) => this . setPulseTourBtn ( false ) , 3000 ) ;
37
+ }
38
+ }
39
+
40
+ setPulseTourBtn = pulseTourBtn => this . setState ( { pulseTourBtn } ) ;
41
+
31
42
handleHidePanels = ( ) => {
32
43
const {
33
44
setMapSettings,
@@ -49,7 +60,7 @@ class MapControlsButtons extends PureComponent {
49
60
onBasemapsRequestClose = ( ) => {
50
61
const isTargetOnTooltip = isParent ( this . basemapsRef , this . basemapsRef . evt ) ;
51
62
this . basemapsRef . clearEvt ( ) ;
52
- if ( ! isTargetOnTooltip && this . state . showBasemaps ) {
63
+ if ( ! isTargetOnTooltip && this . props . settings . showBasemaps ) {
53
64
this . toggleBasemaps ( ) ;
54
65
}
55
66
} ;
@@ -67,8 +78,8 @@ class MapControlsButtons extends PureComponent {
67
78
} ;
68
79
69
80
toggleBasemaps = ( ) => {
70
- const { setRecentImagerySettings } = this . props ;
71
- this . setState ( state => ( { showBasemaps : ! state . showBasemaps } ) ) ;
81
+ const { setRecentImagerySettings, setMapSettings , settings } = this . props ;
82
+ setMapSettings ( { showBasemaps : ! settings . showBasemaps } ) ;
72
83
setRecentImagerySettings ( { visible : false } ) ;
73
84
} ;
74
85
@@ -120,7 +131,7 @@ class MapControlsButtons extends PureComponent {
120
131
121
132
return (
122
133
< Button
123
- className = " recent-imagery-btn"
134
+ className = { cx ( ' recent-imagery-btn' , 'map-tour-recent-imagery' ) }
124
135
theme = "theme-button-map-control"
125
136
onClick = { this . handleToggleRecentImagery }
126
137
disabled = { datasetsLoading }
@@ -148,11 +159,11 @@ class MapControlsButtons extends PureComponent {
148
159
} ;
149
160
150
161
renderBasemapsBtn = ( ) => {
151
- const { showBasemaps } = this . state ;
162
+ const { showBasemaps } = this . props . settings ;
152
163
153
164
return (
154
165
< Button
155
- className = " basemaps-btn"
166
+ className = { cx ( ' basemaps-btn' ) }
156
167
theme = "theme-button-map-control"
157
168
onClick = { this . toggleBasemaps }
158
169
tooltip = {
@@ -189,7 +200,7 @@ class MapControlsButtons extends PureComponent {
189
200
} ;
190
201
191
202
renderBasemapsTooltip = ( ) => {
192
- const { showBasemaps } = this . state ;
203
+ const { showBasemaps } = this . props . settings ;
193
204
194
205
return (
195
206
< Tooltip
@@ -302,6 +313,21 @@ class MapControlsButtons extends PureComponent {
302
313
</ Button >
303
314
) ;
304
315
316
+ renderMapTourBtn = ( ) => (
317
+ < Button
318
+ theme = "theme-button-map-control"
319
+ tooltip = { { text : 'Take a tour of the map' } }
320
+ onClick = { ( ) => this . props . setMapTourOpen ( true ) }
321
+ >
322
+ < Icon
323
+ icon = { helpIocn }
324
+ className = { cx ( 'map-tour-icon' , {
325
+ 'pulse-tour-btn' : this . state . pulseTourBtn
326
+ } ) }
327
+ />
328
+ </ Button >
329
+ ) ;
330
+
305
331
renderMapPosition = ( ) => {
306
332
const { settings } = this . props ;
307
333
const { zoom, center } = settings || { } ;
@@ -331,11 +357,12 @@ class MapControlsButtons extends PureComponent {
331
357
{ this . renderBasemapsTooltip ( ) }
332
358
</ div >
333
359
) }
334
- < div className = " controls-wrapper" >
360
+ < div className = { cx ( ' controls-wrapper' , 'map-tour-map-controls' ) } >
335
361
{ this . renderZoomButtons ( ) }
336
362
{ this . renderShowPanelsButton ( ) }
337
363
{ this . renderShareButton ( ) }
338
364
{ this . renderPrintButton ( ) }
365
+ { this . renderMapTourBtn ( ) }
339
366
</ div >
340
367
{ this . renderMapPosition ( ) }
341
368
</ Fragment >
@@ -357,6 +384,8 @@ MapControlsButtons.propTypes = {
357
384
settings : PropTypes . object ,
358
385
active : PropTypes . bool ,
359
386
setMenuSettings : PropTypes . func ,
387
+ setMapTourOpen : PropTypes . func ,
388
+ mapTourOpen : PropTypes . bool ,
360
389
recentSettings : PropTypes . object ,
361
390
recentLoading : PropTypes . bool ,
362
391
setRecentImagerySettings : PropTypes . func ,
0 commit comments