Skip to content

Commit 5f511b4

Browse files
improved balloon mode switching
1 parent dd0e816 commit 5f511b4

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

js/tracker.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -784,18 +784,11 @@ function updateVehicleInfo(vcallsign, newPosition) {
784784
);
785785

786786
if(landed) {
787-
vehicle.marker.setMode("landed");
788-
vehicle.marker.shadow.setVisible(false);
789-
vehicle.horizon_circle.setVisible(false);
790-
vehicle.horizon_circle.label.set('visible', false);
791-
vehicle.subhorizon_circle.setVisible(false);
792-
vehicle.subhorizon_circle.label.set('visible', false);
793-
794-
} else if(vehicle.ascent_rate > -3.0 ||
795-
vcallsign == "wb8elk2") {
796-
vehicle.marker.setMode("balloon");
787+
vehicle.marker.setMode("landed");
788+
} else if(vehicle.ascent_rate > -3.0) {
789+
vehicle.marker.setMode("balloon");
797790
} else {
798-
vehicle.marker.setMode("parachute");
791+
vehicle.marker.setMode("parachute");
799792
}
800793
}
801794

@@ -1445,27 +1438,43 @@ function addPosition(position) {
14451438
marker.balloonColor = (vcallsign == "PIE") ? "rpi" : balloon_colors_name[color_index];
14461439
marker.mode = 'balloon';
14471440
marker.setMode = function(mode) {
1441+
if(this.mode == mode) return;
1442+
14481443
this.mode = mode;
14491444
var img;
14501445
if(mode == "landed") {
1446+
vehicle.marker.shadow.setVisible(false);
1447+
vehicle.horizon_circle.setVisible(false);
1448+
vehicle.horizon_circle.label.set('visible', false);
1449+
vehicle.subhorizon_circle.setVisible(false);
1450+
vehicle.subhorizon_circle.label.set('visible', false);
1451+
14511452
img = {
1452-
url: host_url + markers_url + "payload-" + this.balloonColor + ".png",
1453-
size: new google.maps.Size(17,18),
1454-
scaledSize: new google.maps.Size(17,18),
1455-
anchor: new google.maps.Point(8,14)
1456-
};
1457-
} else if(mode == "parachute") {
1458-
img = {
1453+
url: host_url + markers_url + "payload-" + this.balloonColor + ".png",
1454+
size: new google.maps.Size(17,18),
1455+
scaledSize: new google.maps.Size(17,18),
1456+
anchor: new google.maps.Point(8,14)
1457+
};
1458+
} else {
1459+
vehicle.marker.shadow.setVisible(true);
1460+
vehicle.horizon_circle.setVisible(true);
1461+
vehicle.horizon_circle.label.set('visible', true);
1462+
vehicle.subhorizon_circle.setVisible(true);
1463+
vehicle.subhorizon_circle.label.set('visible', true);
1464+
1465+
if(mode == "parachute") {
1466+
img = {
14591467
url: host_url + markers_url + "parachute-" + this.balloonColor + ".png",
14601468
size: new google.maps.Size(46,84),
14611469
scaledSize: new google.maps.Size(46,84)
14621470
};
1463-
} else {
1464-
img = {
1471+
} else {
1472+
img = {
14651473
url: host_url + markers_url + "balloon-" + this.balloonColor + ".png",
14661474
size: new google.maps.Size(46,84),
14671475
scaledSize: new google.maps.Size(46,84)
14681476
};
1477+
}
14691478
}
14701479
this.setIcon(img);
14711480
this.setPosition(this.getPosition());

0 commit comments

Comments
 (0)