feat(grid): show full Maidenhead label at subsquare zoom (em13sf, not sf)

This commit is contained in:
Graham McIntire 2026-04-26 09:54:07 -05:00
parent b2aec7e8c8
commit 556967db5a
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -87,8 +87,8 @@ function drawGridSquare(
const px = Math.abs(ne.x - sw.x)
const minW = sub ? 25 : field ? 30 : 40
if (px > minW) {
// Subsquares show just the last 2 chars (e.g. "kp"), others show full label
const text = sub ? grid.substring(4, 6) : grid.substring(0, field ? 2 : 4)
// Show the full grid label at every level (e.g. "EM13sf" for a subsquare)
const text = field ? grid.substring(0, 2) : sub ? grid.substring(0, 6) : grid.substring(0, 4)
const len = text.length
const fs = Math.max(9, Math.min(sub ? 12 : 14, Math.round(px / (len * 1.2))))
layerGroup.addLayer(L.marker([c.center.lat, c.center.lon], {