From 1ffb5ed9e8b562eee95f801c88c3934f50637518 Mon Sep 17 00:00:00 2001 From: atsunatsu Date: Fri, 11 Sep 2026 23:12:33 +0800 Subject: [PATCH] fix(map): polar 2-char labels visible + own-grid bold only at sub-square zoom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Polar bands (80..90 / -90..-80) extend past the map's latitude limit, so their label center fell off-screen and the labels never rendered. Labels are now centered in the VISIBLE part of the cell; fully off-screen cells are still skipped. Verified with a projection-accurate simulation render: Arctic band shows IR/JR, Antarctic band shows IA/JA, ±80 lines intact. - Own-grid bold outline is drawn only at sub-square zoom (zoom >= 6): at field zoom (2-char labels) the current grid is no longer marked (user request). The ownGrid-set-every-frame fix stays, so the outline still survives map refreshes at sub-square zoom. --- .../feature/map/MaidenheadGridOverlay.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt index 333c07da..26105476 100644 --- a/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt +++ b/feature/map/src/main/java/com/rtbishop/look4sat/feature/map/MaidenheadGridOverlay.kt @@ -135,10 +135,9 @@ class MaidenheadGridOverlay : Overlay() { val worldTurns = ceil(((rightLon - leftLon) / 360.0) - 1e-9).toInt().coerceAtLeast(0) val colRepeats = if (worldTurns > 0) worldTurns else 0 - // The station's own grid: 4-char square at sub-square zoom, 2-char - // field at field zoom. Always marked so the "you are here" outline is - // visible even at the default entry zoom (below GRID_ZOOM_SUB). - val ownCell = ownGrid?.let { if (zoom >= GRID_ZOOM_SUB) it else it.take(2) } + // The station's own grid: bold outline only at sub-square zoom — at + // field zoom (2-char labels) the current grid is NOT marked (user req). + val ownCell = ownGrid?.takeIf { zoom >= GRID_ZOOM_SUB } // The tapped worked grid gets a distinct outline (same zoom gate). val selectedCell = selectedGrid?.takeIf { zoom >= GRID_ZOOM_SUB } @@ -338,8 +337,14 @@ class MaidenheadGridOverlay : Overlay() { if (topLatCell > 90.0) continue val yTop = projectionToY(projection, topLatCell) ?: continue val yBottom = projectionToY(projection, lat) ?: continue - val yCenter = (yTop + yBottom) / 2f - textHalfHeight - if (yBottom < 0f || yTop > canvas.height) continue + // Polar bands (80..90 / -90..-80) extend beyond the map's latitude + // limit, so their geometric center falls off-screen and the label + // would never be visible. Center the label in the VISIBLE part of + // the cell instead; fully off-screen cells are still skipped. + val visTop = maxOf(yTop, 0f) + val visBottom = minOf(yBottom, canvas.height.toFloat()) + if (visBottom < 0f || visTop > canvas.height) continue + val yCenter = (visTop + visBottom) / 2f - textHalfHeight for (turn in -colRepeats..colRepeats) for (col in firstCol..lastCol) { val lon = col * cellLon // World-repeat copies: keep the turn offset in pixels (same