Skip to content

Commit 4742e22

Browse files
committed
Change balloon color selection to be stable per-balloon
1 parent 9bb8fa4 commit 4742e22

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

@@ -3088,7 +3086,11 @@ function addPosition(position) {
30883086
marker.addTo(map);
30893087
} else {
30903088
vehicle_type = "balloon";
3091-
color_index = balloon_index++ % balloon_colors.length;
3089+
let colorHash = 0;
3090+
for (let i = 0; i < vcallsign.length; i++){
3091+
colorHash += vcallsign.charCodeAt(i);
3092+
}
3093+
color_index = colorHash % balloon_colors.length;
30923094

30933095
if(wvar.nena){
30943096
// All the balloon are red.

0 commit comments

Comments
 (0)