From 7ee6868a2a9338ac4b67c4cdc44dfdae6f2f0a1f Mon Sep 17 00:00:00 2001 From: TerraMaster85 Date: Fri, 11 Jul 2025 00:08:15 -0400 Subject: [PATCH] fix: planet indicator direction --- crates/unified/src/client/planet/indicators.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/unified/src/client/planet/indicators.rs b/crates/unified/src/client/planet/indicators.rs index 405b8780e62383cfd069d6f08ad116b9fd6202f8..8bb3bf2f4057c1d3012d080dabcfaf18dd1c70f1 100644 --- a/crates/unified/src/client/planet/indicators.rs +++ b/crates/unified/src/client/planet/indicators.rs @@ -80,12 +80,20 @@ fn update_indicators_position( for (planet_position, indicator_id) in &planets_w_indicator { let mut offset = planet_position.translation - player_position.translation; - let sprite_size = 25.0 * camera.scale.z; + let sprite_size = 32.0 * camera.scale.z; let half_window_height = window.height() * camera.scale.z / 2.0 - (sprite_size / 2.0); let half_window_width = window.width() * camera.scale.z / 2.0 - (sprite_size / 2.0); - offset.x = offset.x.clamp(-half_window_width, half_window_width); - offset.y = offset.y.clamp(-half_window_height, half_window_height); + + // scale both parts to fit x, then same for y + if offset.x.abs() > half_window_width { + let scale_factor = offset.x.clamp(-half_window_width, half_window_width) / offset.x; + offset = offset * scale_factor; + } + if offset.y.abs() > half_window_height { + let scale_factor = offset.y.clamp(-half_window_height, half_window_height) / offset.y; + offset = offset * scale_factor; + } let Ok((mut this_indicator, mut this_sprite)) = indicators.get_mut(indicator_id.0) else { continue;