Commit cf6daf6 1 parent f8a5aa5 commit cf6daf6 Copy full SHA for cf6daf6
File tree 2 files changed +27
-10
lines changed
2 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " traccar-route-replay" ,
3
- "version" : " 1.2.7 " ,
3
+ "version" : " 1.2.8 " ,
4
4
"private" : true ,
5
5
"scripts" : {
6
6
"dev" : " nuxt" ,
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ export default {
116
116
loading: false ,
117
117
playing: false ,
118
118
i: 0 ,
119
+ start: 0 ,
119
120
playSpeed: 400 ,
120
121
follow: false ,
121
122
sliderBackground: ' '
@@ -167,10 +168,11 @@ export default {
167
168
await this .$store .dispatch (' getPath' )
168
169
this .loading = false
169
170
},
171
+ start () {
172
+ this .updateRoute ()
173
+ },
170
174
i () {
171
- if (this .i > 1 && map .getSource (' route' )) {
172
- map .getSource (' route' ).setData (lineString (this .path .slice (0 , this .i )))
173
- }
175
+ this .updateRoute ()
174
176
if (this .path [this .i ]) {
175
177
if (this .playing ) {
176
178
this .updateSlider ()
@@ -375,13 +377,15 @@ export default {
375
377
})
376
378
this .$refs .noUiSlider .noUiSlider .on (' update' , ([from , to ]) => {
377
379
this .currentTime = to
378
- const start = closest (this .timestamps , from)
379
- if (start && map .getSource (' route' )) {
380
- map .getSource (' route' ).setData (lineString (this .path .slice (start)))
381
- }
380
+ this .start = closest (this .timestamps , from)
382
381
})
383
382
},
384
383
methods: {
384
+ updateRoute () {
385
+ if (this .start > 0 && this .i > this .start && map .getSource (' route' )) {
386
+ map .getSource (' route' ).setData (lineString (this .path .slice (this .start , this .i )))
387
+ }
388
+ },
385
389
updateSlider () {
386
390
this .$refs .noUiSlider .noUiSlider .set ([null , this .currentTime ])
387
391
},
@@ -557,8 +561,21 @@ export default {
557
561
type: ' line' ,
558
562
source: ' route' ,
559
563
paint: {
560
- ' line-color' : green,
561
- ' line-width' : 8
564
+ ' line-color' : ' #2d5f99' ,
565
+ ' line-width' : 10
566
+ },
567
+ layout: {
568
+ ' line-join' : ' round' ,
569
+ ' line-cap' : ' round'
570
+ }
571
+ })
572
+ map .addLayer ({
573
+ id: ' routeCasing' ,
574
+ type: ' line' ,
575
+ source: ' route' ,
576
+ paint: {
577
+ ' line-color' : ' #4882c5' ,
578
+ ' line-width' : 5
562
579
},
563
580
layout: {
564
581
' line-join' : ' round' ,
You can’t perform that action at this time.
0 commit comments