Skip to content

Polygon/drawing fixes: canonical z-order, click-to-select, draw UX (eo-gpt #111) - #14

Merged
TommySquared merged 2 commits into
mainfrom
fix/polygon-drawing-issues
Sep 18, 2026
Merged

TommySquared merged 2 commits into
mainfrom
fix/polygon-drawing-issues

Conversation

@TommySquared

@TommySquared TommySquared commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Layer ordering

Root cause of the "ordering flips after reorder" and "polygons sometimes over tifs" reports: the DB assigned every new asset z_index = max+1, while the map client force-inserted rasters below all vectors, move_layer was broadcast-only (never persisted), and snapshot restore re-applied the raster heuristic — so layer-manager order and render order disagreed until a reorder forcibly synced them, and reloads silently undid explicit raster-above-vector arrangements.

z_index is now canonical end to end:

  • create_asset slots rasters (geotiffs/tiles) just below the lowest vector; vectors stack on top
  • move_layer persists (new move_asset renumber); reorder_assets unchanged
  • add broadcasts carry z_index; the client inserts by z (beforeIdForZ) and re-syncs registry order after moves/reorders
  • snapshot restore replays by z, so user reorders survive reconnects

Draw interactions

  • the terra-draw adapter's pre-drawing minPixelDragDistance defaults to 1 px, so any press jitter reclassified the click as an ignored drag (while drawing, the threshold is 8 px — which is why only the first click died). Raised to 8.
  • Circle / rectangle / freehand now accept both click-move-click and press-drag-release (drawInteraction: 'click-move-or-drag'). Polygon/line stay click-per-vertex (terra-draw has no drag variant; freehand is the drag way to sketch a polygon).
  • Finishing a shape reverts to pan mode (deliberate reversal of the old always-armed behavior).
  • Mode transitions clear stale inline cursors left by the hover systems. Note: Chromium only repaints the cursor on pointer movement — the delayed-switch-on-idle-mouse report is a browser limitation (Firefox repaints immediately).

Selection (item 7)

Hover cards are gone (they pinned at the hover start point and, zoomed inside a large polygon, could never be dismissed). Clicking an asset emphasizes its border (original paint saved and restored verbatim on deselect/empty-click); the default outfit focuses the panel row on click instead of peeking on hover.

Perf follow-up

  • maxTileCacheSize: 512 — panning back over visited areas renders from memory
  • cancelPendingTileRequestsWhileZooming: false — zooms no longer end on blank chunks (accepted bandwidth tradeoff)

Testing

New tests/test_layer_order.py pins the server-side stacking policy. NB the pytest harness hang at lifespan is pre-existing (MCP-related) — the ordering/move/reorder logic was additionally verified with a standalone script against a temp DB (all assertions pass).

🤖 Generated with Claude Code

TommySquared and others added 2 commits September 18, 2026 16:25
…w UX (issue #111)

Layer ordering (items 1+2): the DB gave every new asset z_index = max+1
while the map client force-inserted rasters below all vectors, move_layer
was broadcast-only, and snapshot restore re-applied the raster heuristic —
so layer-manager order and render order disagreed until a reorder forcibly
synced them. z_index is now canonical everywhere: create_asset slots
rasters just below the lowest vector, move_layer persists, add broadcasts
carry z_index, and the client inserts/restores by z instead of heuristics.

Draw interactions:
- First click did nothing (item 6): the adapter's pre-drawing
  minPixelDragDistance default is 1px, so any press jitter reclassified
  the click as an ignored drag. Raised to 8px (the while-drawing default).
- Circle/rectangle/freehand accept click-move-or-drag (item 5).
- Finishing a shape reverts to pan mode (item 4).
- Mode transitions clear stale inline cursors from the hover systems;
  crosshair/pointer arbitration is class-based and synchronous (item 3).

Selection (item 7): hover cards are gone (they pinned themselves at the
hover start and, zoomed inside a large polygon, could never be dismissed).
Clicking an asset now emphasizes its border (restored verbatim on
deselect/empty-click); the default outfit focuses the panel row instead of
peeking on hover. tests: new test_layer_order.py pins the server policy
(NB: the pytest harness hang is pre-existing; logic verified standalone).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- maxTileCacheSize: 512 — the default viewport-sized cache re-fetched
  (and re-faded) tiles the moment you panned back over them; a fixed
  512-tile cache keeps the session's working set hot.
- cancelPendingTileRequestsWhileZooming: false — the default abandoned
  in-flight requests mid-gesture, so zooms ended on blank chunks that
  restarted from zero. Bandwidth is not our bottleneck; fill the frame.

(The other loading-speed lever — 512px tiles — turned out to already be
in place: MapTiler raster entries serve native 512 PNG; only the keyless
OSM/Esri fallbacks are 256, and neither provider offers 512.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TommySquared
TommySquared merged commit b080e78 into main Sep 18, 2026
3 checks passed
@TommySquared
TommySquared deleted the fix/polygon-drawing-issues branch September 18, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant