tune(map): 4-char sub-square labels at zoom>=7; zoom 6 shows grid lines only

This commit is contained in:
atsunatsu committed 2026-09-08 01:55:40 +08:00
1 parent 736dc23aae
commit 72d5e13acf
1 file changed
+6 -2
@@ -203,8 +203,9 @@ class MaidenheadGridOverlay : Overlay() {
// Labels: centered in each cell, only when the cell is large enough on // Labels: centered in each cell, only when the cell is large enough on
// screen to hold a label (avoid clutter at low zoom). // screen to hold a label (avoid clutter at low zoom).
// Field (2-char) labels show at every zoom, subject only to the pixel- // Field (2-char) labels show at every zoom, subject only to the pixel-
// size check below; sub-square (4-char) labels only from GRID_ZOOM_SUB. // size check below; sub-square (4-char) labels only from LABEL_ZOOM_SUB
val showLabels = zoom >= GRID_ZOOM_SUB || cellLat == FIELD_LAT // (one level above the grid lines, so zoom 6 shows lines but no names).
val showLabels = zoom >= LABEL_ZOOM_SUB || cellLat == FIELD_LAT
if (!showLabels) return if (!showLabels) return
// Estimate on-screen cell height to avoid clutter at low zoom: // Estimate on-screen cell height to avoid clutter at low zoom:
// project two points 1° apart in latitude and measure the pixel distance. // project two points 1° apart in latitude and measure the pixel distance.
@@ -315,6 +316,9 @@ class MaidenheadGridOverlay : Overlay() {
// the sub-square grid is too dense to read; 6 roughly doubles the // the sub-square grid is too dense to read; 6 roughly doubles the
// on-screen size of each square. // on-screen size of each square.
const val GRID_ZOOM_SUB = 6.0 const val GRID_ZOOM_SUB = 6.0
// Zoom at which the 4-char sub-square names appear (one level above the
// grid lines: zoom 6 = lines only, zoom 7+ = lines + names).
const val LABEL_ZOOM_SUB = 7.0
const val MIN_LABEL_CELL_PX = 48f const val MIN_LABEL_CELL_PX = 48f
const val MAX_OVERSHOOT_PX = 64 const val MAX_OVERSHOOT_PX = 64
} }