From 8e8a3849df35052946c24dac1c8f820166c1a239 Mon Sep 17 00:00:00 2001 From: atsunatsu Date: Mon, 21 Sep 2026 11:35:10 +0800 Subject: [PATCH] fix(map): first-call labels now appear exactly when grid lines do MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 11.2 gate only relaxed the pre-return zoom check, but the showLabels gate below it still required LABEL_ZOOM_SUB (6.5), so first-call labels stayed hidden in the 6.0..6.5 band where the 4-char grid lines render. - Gate showLabels on GRID_ZOOM_SUB (6.0) when showFirstCallLabels is on. - Relax MIN_LABEL_CELL_PX (48) to 0.6x for first-call mode so 1° cells (~45 px on the equator at zoom 6.0) are not filtered out. Normal grid-code labels are unchanged (still LABEL_ZOOM_SUB). --- .../look4sat/feature/map/MaidenheadGridOverlay.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 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 6876a610..5a2f9885 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 @@ -370,7 +370,13 @@ class MaidenheadGridOverlay : Overlay() { // Show as soon as the 4-char grid LINES appear (GRID_ZOOM_SUB), not // only at the name-label zoom — user req 2026-09-21. if (showFirstCallLabels && zoom < GRID_ZOOM_SUB) return - val showLabels = zoom >= LABEL_ZOOM_SUB || cellLat == FIELD_LAT + // First-call labels gate on the grid-LINE zoom; normal labels keep the + // name-label zoom (one level above the lines). + val showLabels = if (showFirstCallLabels) { + zoom >= GRID_ZOOM_SUB + } else { + zoom >= LABEL_ZOOM_SUB || cellLat == FIELD_LAT + } if (!showLabels) return // Estimate on-screen cell height to avoid clutter at low zoom: // project two points 1° apart in latitude and measure the pixel distance. @@ -378,7 +384,11 @@ class MaidenheadGridOverlay : Overlay() { val y2 = projectionToY(projection, 1.0) if (y1 == null || y2 == null) return val pixelsPerDegree = Math.abs(y2 - y1) - if (pixelsPerDegree * cellLat < MIN_LABEL_CELL_PX) return + // First-call labels must appear as soon as the 4-char grid LINES do + // (zoom 6.0), where 1° cells are ~45 px on the equator — below the + // 48 px normal-label threshold. Relax the pixel gate for this mode only. + val minCellPx = if (showFirstCallLabels) MIN_LABEL_CELL_PX * 0.6f else MIN_LABEL_CELL_PX + if (pixelsPerDegree * cellLat < minCellPx) return val activePaint = if (showFirstCallLabels) firstCallPaint else labelPaint activePaint.textAlign = Paint.Align.CENTER