fuzzyworld

haunt / commit

Fix map scale driven by RTT outliers in history trail

64e9d8e6193175c85d82e8cb783ed2040969f007 · Pavel Safronov · 2026-05-13 13:12:30 -0700 · parents 56247a852e0a

Fix map scale driven by RTT outliers in history trail

History points can contain garbage distances (RTT returns hundreds of
metres on error), which pushed maxY to enormous values and collapsed all
named points into a single pixel at the top. Viewport now uses only saved
points and lights; history and 'you' are drawn at wherever they fall on
that scale.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
 app/src/main/java/net/fuzzyworld/haunt/debug/MapView.kt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/net/fuzzyworld/haunt/debug/MapView.kt b/app/src/main/java/net/fuzzyworld/haunt/debug/MapView.kt
index e623c83..de9b47e 100644
--- a/app/src/main/java/net/fuzzyworld/haunt/debug/MapView.kt
+++ b/app/src/main/java/net/fuzzyworld/haunt/debug/MapView.kt
@@ -195,9 +195,10 @@ class MapView @JvmOverloads constructor(
 
         val padPx = 72f
 
-        // Scale is determined by named points + history only — "you" does not expand the viewport.
-        // This keeps saved points visible and spread out even when you wander far from them.
-        val anchorCoords = savedCoords.map { it.second } + lightCoords.map { it.second } + historyCoords
+        // Scale is determined by named points only — history trail and "you" don't expand the viewport.
+        // History can contain RTT outliers (hundreds of metres) that would collapse the real points
+        // into a single pixel at the top of the canvas.
+        val anchorCoords = savedCoords.map { it.second } + lightCoords.map { it.second }
         val scaleCoords = anchorCoords.ifEmpty { listOfNotNull(currentCoords) }
 
         val minX = (scaleCoords.minOf { it.first } - 1.0).coerceAtLeast(0.0)