Skip to content

Move AOI's analyze and cancel card onto the core popup service - #424

Draft
CarsonDavis wants to merge 3 commits into
feature/298-map-popup-service-v2from
feature/299-aoi-popup-migration-v2
Draft

Move AOI's analyze and cancel card onto the core popup service#424
CarsonDavis wants to merge 3 commits into
feature/298-map-popup-service-v2from
feature/299-aoi-popup-migration-v2

Conversation

@CarsonDavis

Copy link
Copy Markdown
Collaborator
Category Lines added %
Tests 738 75.5%
Production code 240 24.5%

AOI's analyze card is now the core popup, and every way of closing it clears the selection.

Closes #299

The analyze card is the core popup

Previously the card was AOI's own tooltip, mounted through the overlay API with its own CSS. A plugin cannot ship DOM across a sandbox boundary, so the card had to become data. It is now the core card, same "Analyze area" then "Cancel" order, label on top, anchored above the selection's centre. Demo mission: search a state.

What each way of closing does

Analyze is unchanged: it hands the selected feature to the statistics and chart plugins and leaves the highlight up. Previously only Cancel cleared the selection, and closing an old card could clear the selection underneath, so AOI retracted the card before every camera move. Now Cancel, the X, Escape and a click on empty map all clear the selection and its highlight; a card that code replaced or retracted leaves it alone. A click on a feature dismisses nothing, so a new selection replaces the open card. Demo mission: all four, then a second state.

Drawing over a selection

Previously the card sat there through the whole drawing session. Now starting a drawing parks the selection and takes the card down, cancelling before a vertex restores both, and the first vertex drops it for good. Demo mission: open a card, draw, press Escape; repeat and click once.

Shape identity, lines and points

The panel follows the shape the engine actually started, not the button pressed, visible when switching shape mid-session. Centroid and bounds now handle linestrings and points too. Demo mission: shape identity yes; lines and points only if the mission's draw shapes include them, unlike the default three.

Closing AOI mid-flight

Previously a selection made and instantly closed could leave an orphan card up to 1.5 s later. Now core closes it on destroy, and a selection superseded before its card opens never opens one. Demo mission: select, then close AOI. The tooltip component and its styles are gone, and the unused drawingCancelled event with them.

Decisions to review

  • Drawing a new area suspends the previous selection and can restore it. drawstart retracts the card but keeps the selection, the first vertex drops it (plugin:aoi:drawingCleared now fires mid-session, not at completion), and drawcancel reopens the old card. The restore re-anchors without re-framing, so a selection panned off screen gets its card at the view centre.
  • The label goes as title, rendered as text, not as an html body. Labels from boundary data and uploads cannot inject markup, but the body slot stays unused, so a future "size under the name" needs a contract change, not a payload change.
  • Centroid and bounds were generalized from polygons to lines and points. A linestring selection now gets a card and can move the camera; a point yields a degenerate bbox the fit step refuses, so its card may land at the view centre. The alternative was polygon-only helpers with a guard on the popup path.
  • plugin:aoi:drawingCancelled is gone from AOI's emitted contract. Nothing in the repo listens, so the blast radius is zero today, though it matters more once plugins are third-party artifacts. The alternative was keeping it on a secondary press.

AOI asks core for its card with plain data through its own handle and acts on how the card closed: Analyze runs the analysis, Cancel, the X, Escape and an empty-map click clear the selection, and a card that code replaced or retracted leaves the selection alone. Starting a drawing parks the selection and takes the card down; cancelling before a vertex puts both back. The tool's own tooltip component and its styles are gone, and the centroid and bounds helpers handle lines and points.
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