correctly show unknown star distances

This commit is contained in:
yuni 2024-04-08 02:26:14 +02:00
parent 58bd34cfd0
commit 9881154489

View file

@ -527,7 +527,11 @@ fn update_hud(
// Target display
let (x, y, z, dist_scalar) : (f64, f64, f64, f64);
if let Ok((_, IsClickable { distance: Some(dist), .. })) = q_target.get_single() {
if *dist >= 100000.0 {
dist_scalar = f64::NAN;
} else {
dist_scalar = *dist;
}
(x, y, z) = (0.0, 0.0, 0.0);
}
else {
@ -552,7 +556,10 @@ fn update_hud(
}
}
if dist_scalar != 0.0 {
if dist_scalar.is_nan() {
text.sections[7].value = format!("distance: UNKNOWN");
}
else if dist_scalar != 0.0 {
text.sections[7].value = format!("{x:.0}m / {z:.0}m / {y:.0}m / distance: {dist_scalar:.0}m");
}
else {