feat(grid): show full Maidenhead label at subsquare zoom (em13sf, not sf)
This commit is contained in:
parent
b2aec7e8c8
commit
556967db5a
1 changed files with 2 additions and 2 deletions
|
|
@ -87,8 +87,8 @@ function drawGridSquare(
|
||||||
const px = Math.abs(ne.x - sw.x)
|
const px = Math.abs(ne.x - sw.x)
|
||||||
const minW = sub ? 25 : field ? 30 : 40
|
const minW = sub ? 25 : field ? 30 : 40
|
||||||
if (px > minW) {
|
if (px > minW) {
|
||||||
// Subsquares show just the last 2 chars (e.g. "kp"), others show full label
|
// Show the full grid label at every level (e.g. "EM13sf" for a subsquare)
|
||||||
const text = sub ? grid.substring(4, 6) : grid.substring(0, field ? 2 : 4)
|
const text = field ? grid.substring(0, 2) : sub ? grid.substring(0, 6) : grid.substring(0, 4)
|
||||||
const len = text.length
|
const len = text.length
|
||||||
const fs = Math.max(9, Math.min(sub ? 12 : 14, Math.round(px / (len * 1.2))))
|
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], {
|
layerGroup.addLayer(L.marker([c.center.lat, c.center.lon], {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue