1 Commits

Author SHA1 Message Date
631b316118 Adjust a measured circle's radius from its tooltip, in ground metres
Officers asked to enter an exact distance rather than drag for it. The tooltip
that appears when the second click lands now carries the adjustment: minus, the
figure itself, plus. Tapping the figure swaps in a numeric input, so an exact
radius can be typed; inputmode="decimal" brings up a keypad rather than a full
keyboard on a phone.

Not a dial. A radius runs from a few metres to several kilometres and no dial
gives usable resolution across that range on a tooltip this size. Stepping snaps
to an increment that grows with the value — 1 m below 50, 5 m below 200, 10 m
below 1 km, 50 m below 5 km — so one tap means something at either end, and
repeated taps land on round numbers instead of carrying the fraction the drag
happened to finish on.

Everything writes through MapTools.setCircleRadius(). Measurements were made
read-only earlier precisely because a draggable handle moved the geometry while
the popup went on reporting the radius captured at draw time; a single path
means the geometry, the radius line, the tooltip and the analysis popup cannot
drift apart again.

The figures are now ground distances. The geometry stores a Web Mercator radius,
which overstates the ground by 1/cos(latitude) — a 200 m circle at Wa was 197 m
on the ground. That was invisible while dragging, because the label and the
shape agreed with each other, but typing 200 is a claim about the ground. The
conversion lives in units.js and is applied in the live tooltip, the adjuster
and the Circle Analysis popup, so all three state the same distance.

Two deliberate choices worth knowing before the usability check:

  - The tooltip is frozen where the draw finished. It is anchored to the
    circumference, so re-positioning on every change would slide the buttons out
    from under the officer's thumb. A large adjustment therefore leaves it
    sitting inside the circle rather than on its edge.
  - No measure-complete event fires on adjustment. Consumers read that as "a new
    measurement was drawn", and stepping would emit a stream of false ones.

The overlay is created with stopEvent:false so the map keeps working through the
label; the buttons stop their own events, or a tap would also pan the map.

Service Worker version deliberately unchanged, so reverting does not leave
clients on a newer cache than main.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-08 17:06:14 +02:00