@@ -1269,13 +1269,15 @@ function updateVehicleInfo(vcallsign, newPosition) {
1269
1269
// Balloon is still in flight, so update the marker.
1270
1270
vehicle . landing_marker . setLatLng ( new L . LatLng ( newPosition . data . pred_lat , newPosition . data . pred_lon ) ) ;
1271
1271
// Re-add to map if it's been removed previously.
1272
- if ( vehicle . landing_marker . getMap ( ) == null ) {
1273
- map . addLayer ( vehicle . landing_marker ) ;
1272
+ if ( vehicle . landing_marker_enabled == false ) {
1273
+ vehicle . landing_marker . addTo ( map ) ;
1274
+ vehicle . landing_marker_enabled = true ;
1274
1275
}
1275
1276
} else {
1276
1277
// Balloon has landed, so hide the marker.
1277
1278
// Should we do this? Can we re-add it safely?
1278
- map . removeLayer ( vehicle . landing_marker ) ;
1279
+ vehicle . landing_marker . remove ( ) ;
1280
+ vehicle . landing_marker_enabled = false ;
1279
1281
}
1280
1282
} else {
1281
1283
// Landing marker has not been initialised yet.
@@ -1301,6 +1303,7 @@ function updateVehicleInfo(vcallsign, newPosition) {
1301
1303
1302
1304
// Add the marker to the vehicle object.
1303
1305
vehicle . landing_marker = landing_marker ;
1306
+ vehicle . landing_marker_enabled = true ;
1304
1307
}
1305
1308
1306
1309
}
@@ -2496,11 +2499,14 @@ function addPosition(position) {
2496
2499
title : vcallsign + " Onboard Landing Prediction" ,
2497
2500
zIndexOffset : Z_CAR ,
2498
2501
} ) . addTo ( map ) ;
2502
+ landing_marker_enabled = true ;
2499
2503
} else {
2500
2504
landing_marker = null ;
2505
+ landing_marker_enabled = false ;
2501
2506
}
2502
2507
} else {
2503
2508
landing_marker = null ;
2509
+ landing_marker_enabled = false ;
2504
2510
}
2505
2511
2506
2512
horizon_circle = new L . Circle ( point , {
@@ -2595,6 +2601,7 @@ function addPosition(position) {
2595
2601
title : title ,
2596
2602
marker_shadow : marker_shadow ,
2597
2603
landing_marker : landing_marker ,
2604
+ landing_marker_enabled : landing_marker_enabled ,
2598
2605
image_src : image_src ,
2599
2606
image_src_size : image_src_size ,
2600
2607
image_src_offset : image_src_offset ,
0 commit comments