Skip to content

Commit fea421a

Browse files
fix prediction_burst bug
1 parent 316f5c1 commit fea421a

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# updated on 27-01-2013
2+
# version 3
33

44
img/logo.png
55
img/marker-you.png

js/mobile.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/tracker.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ function redrawPrediction(vehicle_index) {
439439
var max_alt = -99999;
440440
var latlng_burst = null;
441441
var burst_index = 0;
442-
for(var i = 0, ii = data.length; i <ii; i++) {
442+
for(var i = 0, ii = data.length; i < ii; i++) {
443443
latlng = new google.maps.LatLng(data[i].lat, data[i].lon);
444444
line.push(latlng);
445445
if(parseFloat(data[i].alt) > max_alt) {
@@ -463,9 +463,8 @@ function redrawPrediction(vehicle_index) {
463463
draggable: false,
464464
});
465465
}
466-
466+
var image_src;
467467
if(vehicle_names[vehicle_index] != "wb8elk2") { // WhiteStar
468-
var image_src = host_url + markers_url + "target-" + balloon_colors_name[vehicles[vehicle_index].color_index] + ".png";
469468
/*
470469
//icon.infoWindowAnchor = new google.maps.Point(13,5);
471470
@@ -477,17 +476,17 @@ function redrawPrediction(vehicle_index) {
477476
+ '</p>';
478477
*/
479478
var html = "";
480-
if(typeof vehicle.prediction_target !== 'undefined') {
479+
if(vehicle.prediction_target) {
481480
vehicle.prediction_target.setPosition(latlng);
482481
} else {
482+
image_src = host_url + markers_url + "target-" + balloon_colors_name[vehicles[vehicle_index].color_index] + ".png";
483483
vehicle.prediction_target = addMarker(image_src, latlng);
484484
}
485485
} else {
486486
if(vehicle.prediction_target) vehicle.prediction_target = null;
487487
}
488488

489489
if(burst_index != 0 && vehicle_names[vehicle_index] != "wb8elk2") {
490-
var icon = host_url + markers_url + "balloon-pop.png";
491490
/*
492491
//icon.infoWindowAnchor = new google.maps.Point(18,5);
493492
@@ -498,10 +497,11 @@ function redrawPrediction(vehicle_index) {
498497
+ data[burst_index].lat + ', ' + data[burst_index].lon + ', ' + Math.round(data[burst_index].alt) + ' m at ' + time_string
499498
+ '</p>';
500499
*/
501-
if(typeof vehicle.prediction_burst !== 'undefined') {
502-
vehicle.prediction_burst.setPosition(latlng);
500+
if(vehicle.prediction_burst) {
501+
vehicle.prediction_burst.setPosition(latlng_burst);
503502
} else {
504-
vehicle.prediction_burst = addMarker(image_src, latlng);
503+
image_src = host_url + markers_url + "balloon-pop.png";
504+
vehicle.prediction_burst = addMarker(image_src, latlng_burst);
505505
}
506506
} else {
507507
if(vehicle.prediction_burst) vehicle.prediction_burst = null;
@@ -662,7 +662,10 @@ function addPosition(position) {
662662
alt_data: new Array(),
663663
path_enabled: vehicle_type == "balloon" && position.vehicle.toLowerCase().indexOf("iss") == -1,
664664
follow: false,
665-
color_index: c};
665+
color_index: c,
666+
prediction_traget: null,
667+
prediction_burst: null,
668+
};
666669
vehicles.push(vehicle_info);
667670
}
668671

0 commit comments

Comments
 (0)