Skip to content

Commit 76364fd

Browse files
committed
Change balloon color selection to be stable per-balloon
1 parent d7d3dad commit 76364fd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

js/tracker.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ var manual_pan = false;
7474

7575
var car_index = 0;
7676
var car_colors = ["blue", "red", "green", "yellow", "teal", "purple"];
77-
var balloon_index = 0;
7877
var balloon_colors_name = ["red", "blue", "green", "purple", "orange", "cyan"];
7978
var balloon_colors = ["#f00", "blue", "green", "#c700e6", "#ff8a0f", "#0fffca"];
8079

@@ -831,7 +830,6 @@ function clean_refresh(text, force, history_step) {
831830
}
832831

833832
car_index = 0;
834-
balloon_index = 0;
835833
nyan_color_index = 0;
836834
stopFollow(force);
837835

@@ -3102,7 +3100,11 @@ function addPosition(position) {
31023100
marker.addTo(map);
31033101
} else {
31043102
vehicle_type = "balloon";
3105-
color_index = balloon_index++ % balloon_colors.length;
3103+
let colorHash = 0;
3104+
for (let i = 0; i < vcallsign.length; i++){
3105+
colorHash += vcallsign.charCodeAt(i);
3106+
}
3107+
color_index = colorHash % balloon_colors.length;
31063108

31073109
if(wvar.nena){
31083110
// All the balloon are red.

0 commit comments

Comments
 (0)