Add a distance/area measuring tool
CI / check (push) Successful in 46s
CI / deploy (push) Successful in 15s

A ruler button in the top-left control stack, matching NPS's own
Area/Distance ruler. Click to add vertices; distance sums haversine
segment lengths, area uses the spherical-excess polygon formula
(same one turf.js's area() uses) rather than a flat shoelace, since a
flat approximation drifts at park-boundary scale. SI units only
(m/km, m²/km²) — no imperial toggle.
This commit is contained in:
randy committed 2026-09-07 22:15:08 +02:00
1 parent 16d36e4441
commit b6a9c1546e
4 files changed
+281 -2

No files matched your search

+76
View File
@@ -472,6 +472,82 @@ html, body {
word-break: break-word;
}
.measure-ctrl {
position: relative;
}
.measure-ctrl__button svg {
display: block;
margin: 0 auto;
width: 18px;
height: 18px;
}
.measure-ctrl__button.active {
background: #dbe9ff;
}
.measure-panel {
position: absolute;
top: 0;
left: 100%;
margin-left: 8px;
z-index: 20;
display: flex;
align-items: center;
gap: 6px;
min-width: max-content;
background: #fff;
border: 1px solid #ddd;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
padding: 6px 8px;
font-size: 13px;
}
.measure-panel[hidden] {
display: none;
}
.measure-panel__mode {
padding: 4px 8px;
border: none;
border-radius: 4px;
background: none;
font: inherit;
font-size: 12px;
cursor: pointer;
}
.measure-panel__mode:hover {
background: #f0f0f0;
}
.measure-panel__mode.active {
background: #dbe9ff;
font-weight: 600;
}
.measure-panel__result {
min-width: 4em;
color: #333;
font-variant-numeric: tabular-nums;
}
.measure-panel__clear {
border: none;
background: none;
font-size: 16px;
line-height: 1;
color: #888;
cursor: pointer;
padding: 0 2px;
}
.measure-panel__clear:hover {
color: #333;
}
.zoom-level-ctrl__value {
width: 29px;
height: 29px;