14
14
<button
15
15
class =" mapboxgl-ctrl-icon svg-button"
16
16
style =" background-image : url (' backward.svg' )"
17
- @click =" (i - 1 >= 0) && i-- "
17
+ @click =" clickBackward "
18
18
/>
19
19
<button
20
20
class =" mapboxgl-ctrl-icon svg-button"
24
24
<button
25
25
class =" mapboxgl-ctrl-icon svg-button"
26
26
style =" background-image : url (' forward.svg' )"
27
- @click =" (i + 1 < path.length) && i++ "
27
+ @click =" clickForward "
28
28
/>
29
29
<div class =" mapboxgl-ctrl-timeline__label" >
30
30
<input v-model =" from" type =" datetime-local" >
44
44
<label for =" follow" >{{ $t('Follow vehicle') }}</label >
45
45
</div >
46
46
</div >
47
- <div ref =" datetime" class =" mapboxgl-ctrl mapboxgl-ctrl-group mapboxgl-ctrl-timeline__label" style =" padding : 3px " >
48
- {{ timestamps[i] && new Date(timestamps[i]).toLocaleString() }}
49
- </div >
50
47
<div ref =" speedometer" class =" mapboxgl-ctrl" >
51
48
<speedometer :speed =" route[i] && route[i].speed * 1.852" />
52
49
</div >
@@ -152,9 +149,6 @@ export default {
152
149
}
153
150
},
154
151
watch: {
155
- /* currentTime (value) {
156
- this.$refs.noUiSlider.noUiSlider.set([value])
157
- }, */
158
152
geofences () {
159
153
const features = featureCollection (
160
154
this .geofences
@@ -178,6 +172,9 @@ export default {
178
172
map .getSource (' route' ).setData (lineString (this .path .slice (0 , this .i )))
179
173
}
180
174
if (this .path [this .i ]) {
175
+ if (this .playing ) {
176
+ this .updateSlider ()
177
+ }
181
178
const model = get3dModel (this .device && this .device .category )
182
179
overlay .setProps ({
183
180
layers: [new ScenegraphLayer ({
@@ -348,7 +345,6 @@ export default {
348
345
map .on (' style.load' , this .styleLoaded )
349
346
map .on (' styleimagemissing' , this .styleImageMissing )
350
347
map .addControl ({ onAdd : () => this .$refs .slider }, ' top-right' )
351
- map .addControl ({ onAdd : () => this .$refs .datetime }, ' top-right' )
352
348
map .addControl ({ onAdd : () => this .$refs .speedometer }, ' top-right' )
353
349
map .addControl (new mapboxgl.NavigationControl ())
354
350
map .addControl ({ onAdd : () => this .$refs .styleSwitcher })
@@ -366,6 +362,7 @@ export default {
366
362
{ to : value => new Date (value).toLocaleString () },
367
363
{ to : value => new Date (value).toLocaleString () }
368
364
],
365
+ step: 1 ,
369
366
pips: {
370
367
mode: ' positions' ,
371
368
values: [0 , 50 , 100 ],
@@ -379,6 +376,21 @@ export default {
379
376
this .$refs .noUiSlider .noUiSlider .on (' update' , ([from , to ]) => { this .currentTime = to })
380
377
},
381
378
methods: {
379
+ updateSlider () {
380
+ this .$refs .noUiSlider .noUiSlider .set ([null , this .currentTime ])
381
+ },
382
+ clickBackward () {
383
+ if (this .i - 1 >= 0 ) {
384
+ this .i --
385
+ this .updateSlider ()
386
+ }
387
+ },
388
+ clickForward () {
389
+ if (this .i + 1 < this .path .length ) {
390
+ this .i ++
391
+ this .updateSlider ()
392
+ }
393
+ },
382
394
styleImageMissing (e ) {
383
395
if (e .id .startsWith (' regulatory' )) {
384
396
const img = new Image (20 , 20 )
0 commit comments