Document draggable per-warning symbol placement in Brīdinājumi

This commit is contained in:
b0txec
2026-08-23 09:33:45 +03:00
parent c97875d6fe
commit 29f4212901
3 changed files with 7 additions and 2 deletions
+2
View File
@@ -91,6 +91,8 @@ The canvas renders every operator-checked warning at once, composited onto one o
The backend returns warning polygons as raw latitude/longitude points; the frontend projects them to pixel space with a per-resolution affine transform (`x = a·lon + b·lat + c`, `y = d·lon + e·lat + f`). Each transform is a least-squares fit of well-spread Latvian cities' real-world coordinates against the pixel positions already validated for these same map backgrounds by Kartes/Faktiskā (`cityCoords.ts` + `mapConsts.ts`), rather than an independently eyeballed calibration. An earlier 4-corner bounding-box version of this projection could not represent the source artwork's rotation/shear and drifted up to ~200px on the 3840 canvas; the affine fit lands within ~35px.
Each checked warning can additionally carry one editorial weather-symbol placement (`IconPlacement`: symbol code plus `x`/`y`/`size` as fractions of the canvas), reusing the same normalized symbol set and image-loading cache (`components/weatherIcons/weatherIconAssets.ts`) that Faktiskā already uses, rather than a separate asset pipeline. The map canvas itself is the position/size control: pointer-event handlers on the `<canvas>` hit-test against each placement's bounding box and a small corner handle to distinguish a move-drag from a resize-drag, converting screen coordinates through the canvas's internal-vs-displayed size ratio. This is the app's first direct-manipulation canvas control — everywhere else uses plain form inputs. The interactive dashed box and resize handle are drawn as a separate pass (`drawInteractionHandles`, in `Warnings.tsx`) layered on top of the plain export render; `downloadPng` re-runs the plain render immediately before calling `canvas.toBlob`, captures the blob, then restores the interactive overlay, so the handles never reach the exported PNG despite both preview and export sharing the same canvas element.
## What the repository does not provide by itself
- Authorized provider accounts and credentials.