Skip to content

Releases: softwarity/sigmet-draw

v2.1.0

14 Jun 16:32

Choose a tag to compare

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: onViewChange is 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 leaks window listeners 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 .active on click, and the active style is consolidated + configurable across all three engines (incl. MapLibre, which had none). The turnkey SIGMET toolbar does not call setActiveTool yet, 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@v1 to softwarity/release-flow@v1.
  • The adapter's other 0.3–0.5 additions — marker-widget gauge/dial/picker editors, nested toolbar submenus, non-rectangular card frames, live proj4 reprojection (setProjection/viewArea/highlightArea) — are not surfaced by sigmet's public API in this release.

v2.0.2

09 Jun 12:12

Choose a tag to compare

Features

  • Rigid line drag (Ctrl/⌘): dragging the body of a lineSide / corridor line 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's PointerEvent, ≥ 0.2.9.)
  • "Lock map" button: new toolbar.lock option (default true) — a 🔒 toggle at the end of the bar that freezes pan/zoom/rotate so the map can't move while drawing; lock: false hides it.

Breaking

  • toolbar.orientation removed: the bar's flow is now derived from position (top/bottom edge ⇒ horizontal row, left/right ⇒ vertical column). Drop any orientation you passed; the live sigmet.toolbar.orientation getter/setter is gone too. (Mirrors @softwarity/draw-adapter ≥ 0.2.7.)

Internal

  • Bumped @softwarity/draw-adapter to ≥ 0.2.9 (PointerEvent modifier keys for the rigid drag; lock button + setInteractive; per-feature label boxes textBoxSize/textBoxRadius; the 0.2.6 double-click-edit fix on OpenLayers/Leaflet; orientation removal). 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

09 Jun 12:21

Choose a tag to compare

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 PNG Blob (MapLibre & OpenLayers; rejects on Leaflet for now). opts.scale sets 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 the toolbar.snapshot option — "none" | false | null to 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), and shutter (default true) 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 with opts.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 the shutter flash toggle.
  • FIR picker gains two groups before the poles — Complex (intricate, high-vertex borders) and Small (the smallest FIRs).

v2.0.0

09 Jun 12:21

Choose a tag to compare

Features

  • Leaflet support: a third engine alongside MapLibre and OpenLayers — new LeafletAdapter({ map }) (a host-owned L.Map) + createLeafletMap, exported from the new @softwarity/sigmet-draw/leaflet subpath. Leaflet is an optional peerDependency (leaflet >= 1.9); 2D only (no globe, like OpenLayers). Load leaflet/dist/leaflet.css in 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 SigmetStyle by decorate() (style-features.ts), so the adapter never sees a domain type (the ~57 in-adapter SigmetStyle references are gone). Live setStyle(…) re-bakes and re-renders. No change to the public SigmetStyle shape.
  • New exports: SIGMET_LAYERS, SIGMET_HIT, decorate. The toolbar / tooltip DOM helpers moved into the shared lib (src/map/toolbar.ts / tooltip.ts removed). adapter.ts is now a back-compat shim re-exporting the generic types under their historical names (OverlayId, Projection, MapAdapter, …).
  • The OpenLayers DragPan/singleclick fix (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

09 Jun 12:21

Choose a tag to compare

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 to 0.02·span (more magnetic).

v1.1.2

09 Jun 12:22

Choose a tag to compare

Fixes

  • OpenLayers — dragging handles was broken: pressing a handle/guide panned the map instead of moving the handle. OpenLayers' built-in DragPan listens 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 captures pointerdown in the capture phase and stopPropagation()s it when the press lands on a draggable target (isDraggableHit — any handle, or a guide carrying a role), so DragPan never 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

09 Jun 12:22

Choose a tag to compare

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; isReadonly reads 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 from fromTAC() lines up with an antimeridian-crossing FIR (its handles, clipping and pointer input no longer disagree with the coordinates).
  • Antimeridian — lonBand editing: dragging a west > east (AM-crossing) band no longer collapses it — the bounds clamp only to the FIR bbox instead of forcing west ≤ 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 (r0 is 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 other style token (and the OtherStyle export): the opposite-side / quadrant-pick surface is an internal, invisible click zone — there's no reason to theme it. (Breaking only if you set style.other.)
  • Exported the missing TropicalCycloneGeometry type (it's produced by fromTAC).
  • setCursor is now private on both adapters (it was never part of the MapAdapter contract).
  • De-duplicated the hover-cursor logic into a shared cursorForHit helper; added a KM_PER_NM constant for the scattered 1.852 conversions; added lineUsable to 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.ts into a new geo.ts — the controller drops ~290 lines and the helpers are now directly unit-testable.
  • Tests: +29lineUsable; a controller harness (fake adapter) covering move-handle translate, vertex-merge rejection, lonBand wrap, antimeridian load unwrap and read-only mode; and a full geo.ts suite. 154 total.

v1.0.3

09 Jun 12:22

Choose a tag to compare

  • Remove firs.geojson file from root

v1.0.2

09 Jun 12:22

Choose a tag to compare

  • Remove angular cache files
  • Complete .gitignore to prevent them from being added again
  • Add tests for toolbar

v1.0.1

09 Jun 12:22

Choose a tag to compare

Fixes

  • Hover tooltip crash: hovering a shape that momentarily doesn't intersect the FIR (an empty area) no longer throws — updateTooltip now 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 so south ≤ north instead of building a degenerate rectangle. Longitude bands are left untouched (a west > east band 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 mouseup finishes the drag, mirroring the OpenLayers adapter).

Internal

  • OpenLayers hit-testing forwards the full feature property bag (parity with MapLibre).
  • Removed the unused setCursor from the public MapAdapter interface (kept private in each adapter).
  • Documented the tropical-cyclone placeholder centre (toArea) and the process-global toolbar <style> injection.
  • Added prepublishOnly (build + test) and engines.node >= 18.
  • Tests: +17 (tooltip style merge, latBand sorting, toolbar 12-position layout, SigmetToolbar controller); added jsdom for the DOM-level toolbar tests.