Releases: softwarity/sigmet-draw
Releases · softwarity/sigmet-draw
v2.1.0
Maintenance release — no @softwarity/sigmet-draw source or API change. It bumps the shared @softwarity/draw-adapter from ^0.2.9 → ^0.5.0, which carries cross-engine fixes that flow through to the SIGMET drawing on all three maps (MapLibre / OpenLayers / Leaflet).
Fixes (inherited from the adapter)
- Escape cancels a draw mode you just started: after a click on a toolbar button, keyboard focus is returned to the map's key element, so
onKey/Escape keeps firing without having to click the map first. (adapter 0.3.2) - No more listener leaks:
onViewChangeis now single-slot — re-calling it no longer stacks (OpenLayers) or orphans (MapLibre/Leaflet)moveend/move handlers — and the snapshot button's icon-preview no longer leakswindowlisteners when the toolbar is torn down while the pointer is over it. (adapter 0.4.0) - Leaflet — clicking a label selects its shape: an interactive text call-out now surfaces its click (Leaflet markers defaulted to non-bubbling), completing the label-box click fix. (adapter 0.3.1 / 0.3.2)
Changes (inherited from the adapter)
- Toolbar active-tool highlight is now consumer-driven: the adapter no longer sets a sticky
.activeon click, and the active style is consolidated + configurable across all three engines (incl. MapLibre, which had none). The turnkey SIGMET toolbar does not callsetActiveToolyet, so a picked draw tool is no longer kept highlighted (previously it stayed highlighted on OpenLayers/Leaflet). (adapter 0.5.0)
Internal
- CI: release workflow switched from
softwarity/release-notes-action@v1tosoftwarity/release-flow@v1. - The adapter's other 0.3–0.5 additions — marker-widget
gauge/dial/pickereditors, nested toolbar submenus, non-rectangular card frames, liveproj4reprojection (setProjection/viewArea/highlightArea) — are not surfaced by sigmet's public API in this release.
v2.0.2
Features
- Rigid line drag (Ctrl/⌘): dragging the body of a
lineSide/corridorline normally bends it (each endpoint snaps to the nearest border point, warping the end segments). Holding Ctrl (⌘ on Mac) freezes the line's direction — the interior stays rigid and the endpoints keep following the FIR border, the end segments only changing length. (Reads the modifier from the adapter'sPointerEvent, ≥ 0.2.9.) - "Lock map" button: new
toolbar.lockoption (defaulttrue) — a 🔒 toggle at the end of the bar that freezes pan/zoom/rotate so the map can't move while drawing;lock: falsehides it.
Breaking
toolbar.orientationremoved: the bar's flow is now derived fromposition(top/bottom edge ⇒ horizontal row, left/right ⇒ vertical column). Drop anyorientationyou passed; the livesigmet.toolbar.orientationgetter/setter is gone too. (Mirrors@softwarity/draw-adapter≥ 0.2.7.)
Internal
- Bumped
@softwarity/draw-adapterto ≥ 0.2.9 (PointerEventmodifier keys for the rigid drag; lock button +setInteractive; per-feature label boxestextBoxSize/textBoxRadius; the 0.2.6 double-click-edit fix on OpenLayers/Leaflet;orientationremoval). Toolbar submenus are available in the adapter but not surfaced by sigmet yet.
Demo
- A lock-map toggle added to the toolbar playground.
v2.0.1
Features
- Select / deselect a shape: clicking the shape selects it (its editing handles & guides show); clicking the empty map deselects it — leaving a clean view (the filled area + label only), which is exactly what you want before a snapshot. Unlike read-only mode, the shape stays editable: clicking it re-selects it. Placing a tool's shape or
load()-ing one selects it automatically. New API:setSelected(on)/isSelected. (A point's marker stays visible when deselected — it is the geometry, not a control.) - Map snapshot (PNG):
sigmet.snapshot(opts?)captures the current map as a PNGBlob(MapLibre & OpenLayers; rejects on Leaflet for now).opts.scalesets the output pixel-ratio (default = the screen's);opts.target("download" | "clipboard" | "blob") delivers it. The turnkey toolbar shows a capture button by default; configure it via thetoolbar.snapshotoption —"none" | false | nullto hide it, or an object{ quality?, onClick?, shutter? }:quality("native"default, or"low" | "medium" | "high") sets the resolution,onClick("download"default, or"clipboard") is the plain-click delivery with ⌘/Ctrl-click doing the other one (previewed on hover), andshutter(defaulttrue) plays a camera-flash feedback on capture. On Leaflet the button shows but is disabled. The capture hides the editing chrome (handles + construction guides) automatically, so the image is always the clean drawing (area + label) whatever the on-screen selection — override withopts.hideOverlays. (Requires@softwarity/draw-adapter≥ 0.2.5.)
Changes
- Toolbar icons refreshed: the buffer (wide line) tool is now an angled capsule outline with a rounded bend (no centreline), and point is a location pin (
location_on) instead of a bare dot — clearer at a glance. Affects the turnkey toolbar (TOOL_ICONS).
Demo
- Snapshot controls added to the live playground: capture
quality, click delivery (download/clipboard), and theshutterflash toggle. - FIR picker gains two groups before the poles — Complex (intricate, high-vertex borders) and Small (the smallest FIRs).
v2.0.0
Features
- Leaflet support: a third engine alongside MapLibre and OpenLayers —
new LeafletAdapter({ map })(a host-ownedL.Map) +createLeafletMap, exported from the new@softwarity/sigmet-draw/leafletsubpath. Leaflet is an optionalpeerDependency(leaflet >= 1.9); 2D only (no globe, like OpenLayers). Loadleaflet/dist/leaflet.cssin the host.
Internal / API
- Shared adapter extracted to
@softwarity/draw-adapter: the per-engine map adapters moved into a standalone, generic, data-driven package reused across the @softwarity drawing libs. sigmet-draw now consumes it through thin wrappers (MapLibreAdapter/OpenLayersAdapter/LeafletAdapter) that pre-bind the SIGMET layer manifest + hit set — construction is unchanged for hosts (new MapLibreAdapter({ map })still works). - Styling is now carried by the data: each overlay feature embeds its render props, baked from the resolved
SigmetStylebydecorate()(style-features.ts), so the adapter never sees a domain type (the ~57 in-adapterSigmetStylereferences are gone). LivesetStyle(…)re-bakes and re-renders. No change to the publicSigmetStyleshape. - New exports:
SIGMET_LAYERS,SIGMET_HIT,decorate. Thetoolbar/tooltipDOM helpers moved into the shared lib (src/map/toolbar.ts/tooltip.tsremoved).adapter.tsis now a back-compat shim re-exporting the generic types under their historical names (OverlayId,Projection,MapAdapter, …). - The OpenLayers DragPan/
singleclickfix (1.1.2) and the icon-rotation conventions now live once in the shared lib and apply to all three engines.
Demo
- Engine switch is now three-way — MapLibre / OpenLayers / Leaflet.
v1.1.3
Features
- Polygon — minimal TAC, exact clip: redundant polygon vertices are now dropped from the TAC (and greyed) by a single geometric rule — a vertex is dropped iff the triangle it forms with its current neighbours doesn't overlap the FIR, so removing it provably can't move the clipped area. This unifies collinear vertices (flat triangle), runs dragged well outside the FIR (triangle outside it), and keeps every genuine FIR-boundary corner and interior vertex (their triangle dips into the FIR). Result: the fewest points needed to describe the cut, with the clipped area unchanged — no collapse, no over-simplification to a triangle. Replaces the previous distance-tolerance (Douglas-Peucker) collinear pass for polygons.
Fixes
- Polygon transform handle never hides a vertex: the polygon's scale/rotate handle now rests just outside the bounding box (like the line/corridor/buffer handles) instead of on the corner, so it can't end up on top of a vertex (which made that vertex impossible to grab). Dragging a vertex towards it simply grows the box and the handle keeps clear.
- Collinearity detected for any aligned vertex, not just the dragged one: the polygon's TAC-minimisation rule now drops a vertex when its triangle with its neighbours is near-flat (within
0.02·span), re-evaluating the whole ring every frame. So aligning a vertex by moving one of its neighbours (e.g. an endpoint) greys/drops the now-collinear middle vertex too — previously only the actively-dragged vertex was snapped. The drag-time snap capture was likewise widened to0.02·span(more magnetic).
v1.1.2
Fixes
- OpenLayers — dragging handles was broken: pressing a handle/guide panned the map instead of moving the handle. OpenLayers' built-in
DragPanlistens on the viewport and is registered before our adapter, so it latched the pointer-down sequence before the controller could disable panning. The adapter now capturespointerdownin the capture phase andstopPropagation()s it when the press lands on a draggable target (isDraggableHit— any handle, or a guide carrying arole), soDragPannever sees it. Normal map panning and the area "flip side" click are unaffected. (MapLibre was never affected — it re-checks its drag state each move.)
Demo
- The demo now loads a random FIR on each start (instead of always the first) to showcase varied geometries — antimeridian, holes, poles, equator…
v1.1.1
Features
- Read-only mode:
sigmet.setReadonly(true)freezes editing — it hides the toolbar and every grab handle/guide and ignores pointer edits, while the area + on-shape label stay visible.setReadonly(false)restores everything;isReadonlyreads the state. Toggle as often as you like (re-renders on each flip). The demo gains an external Read-only checkbox in its top bar.
Pre-release audit follow-ups (no behaviour change for the common, non-antimeridian case).
Fixes
- Antimeridian — loaded geometry:
load()now re-expresses longitudes in the FIR working frame, so a geometry fromfromTAC()lines up with an antimeridian-crossing FIR (its handles, clipping and pointer input no longer disagree with the coordinates). - Antimeridian —
lonBandediting: dragging awest > east(AM-crossing) band no longer collapses it — the bounds clamp only to the FIR bbox instead of forcingwest ≤ east. - Degenerate line on translate/rotate: after a whole-line drag or transform, the line-side / corridor endpoints are re-snapped to the FIR border and re-validated (
lineUsable); a step that would leave the line collapsed or self-crossing is rejected, so no degenerate TAC is emitted. - Transform scale floor: the polygon/line transform can no longer blow up its scale when the remembered handle anchor sits near the centroid (
r0is floored like the cursor distance). - Strict role parsing: vertex roles are parsed with a strict
^[a-z]\d+$matcher, so a malformed/empty suffix can't silently resolve to vertex 0.
Internal / API
- Removed the
otherstyle token (and theOtherStyleexport): the opposite-side / quadrant-pick surface is an internal, invisible click zone — there's no reason to theme it. (Breaking only if you setstyle.other.) - Exported the missing
TropicalCycloneGeometrytype (it's produced byfromTAC). setCursoris now private on both adapters (it was never part of theMapAdaptercontract).- De-duplicated the hover-cursor logic into a shared
cursorForHithelper; added aKM_PER_NMconstant for the scattered1.852conversions; addedlineUsableto the pure geometry helpers. - God-module split: the ~19 pure lon/lat helpers (haversine, bearing, destination, projection, polyline sampling, bbox, antimeridian (un)wrap, role parsing) moved out of
sigmet-draw.tsinto a newgeo.ts— the controller drops ~290 lines and the helpers are now directly unit-testable. - Tests: +29 —
lineUsable; a controller harness (fake adapter) covering move-handle translate, vertex-merge rejection,lonBandwrap, antimeridianloadunwrap and read-only mode; and a fullgeo.tssuite. 154 total.
v1.0.3
- Remove firs.geojson file from root
v1.0.2
- Remove angular cache files
- Complete .gitignore to prevent them from being added again
- Add tests for toolbar
v1.0.1
Fixes
- Hover tooltip crash: hovering a shape that momentarily doesn't intersect the FIR (an empty area) no longer throws —
updateTooltipnow skips areas with no fillable ring. - Empty intersection:
clip()treats a valid-but-empty JSTS result as a genuine no-overlap (instead of passing an empty geometry downstream). - Latitude band: a reversed-but-legal encoding (
N OF N54 AND S OF N50) is now sorted sosouth ≤ northinstead of building a degenerate rectangle. Longitude bands are left untouched (awest > eastband legitimately crosses the antimeridian). - Antimeridian detection is now structural — the FIR touches both ±180 edges (split form) or has an edge jump > 180° (jump form) — instead of a bbox-width heuristic that could misfire on a very wide non-crossing FIR.
- MapLibre: a drag released outside the map canvas no longer leaves panning disabled (a window-level
mouseupfinishes the drag, mirroring the OpenLayers adapter).
Internal
- OpenLayers hit-testing forwards the full feature property bag (parity with MapLibre).
- Removed the unused
setCursorfrom the publicMapAdapterinterface (kept private in each adapter). - Documented the tropical-cyclone placeholder centre (
toArea) and the process-global toolbar<style>injection. - Added
prepublishOnly(build + test) andengines.node >= 18. - Tests: +17 (tooltip style merge, latBand sorting, toolbar 12-position layout,
SigmetToolbarcontroller); addedjsdomfor the DOM-level toolbar tests.