Skip to content

feat(ui): image map cluster selection mode - #42

Open
lstein wants to merge 1 commit into
feat/image-map-08-live-themefrom
feat/image-map-09-cluster-select
Open

feat(ui): image map cluster selection mode#42
lstein wants to merge 1 commit into
feat/image-map-08-live-themefrom
feat/image-map-09-cluster-select

Conversation

@lstein

@lstein lstein commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR 9 of the Image Map stack — PhotoMapAI's cluster-click behavior:

  • A header toggle (persisted in widget values) switches map clicks between selecting one image and selecting the clicked point's whole DBSCAN cluster: setGalleryMultiSelection with the members ordered by distance from the click (proximity ordering, capped at 5000); the clicked image becomes primary so Preview follows. Noise points fall back to single selection.
  • The gallery's multi-selection renders on the map as a white-outlined "Highlighted Points" overlay between the base points and the gold marker, wherever the selection was made.
  • Performance/correctness architecture (from adversarial review): selection changes restyle the overlay traces in place — the WebGL scene rebuilds only when the point set itself changes, so arrow-key gallery navigation never re-uploads a 50k-point scatter, and the gold marker is re-applied after every rebuild (it can no longer blank when the multi-selection changes around a stable primary). Single- and cluster-selection share one monotonic click sequence, so rapid mixed-mode clicks always resolve to the latest click. The highlight overlay uses hoverinfo: 'skip' so it never shadows the base points.

Known accepted gap (also noted in the floating-windows PR): floating windows render widgets without header/footer chrome, so the mode toggle is only reachable while docked.

Testing

Cluster collection (proximity order, noise/unknown handling, cap keeps nearest incl. the clicked point), highlight trace builder (multi-only, outline), full suite + lint + build green at the stack top.

🤖 Generated with Claude Code

@lstein
lstein requested a review from blessedcoolant as a code owner August 2, 2026 21:49
@github-actions github-actions Bot added the python label Aug 2, 2026
@lstein
lstein marked this pull request as draft August 2, 2026 22:24
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from aa21512 to 32045e9 Compare August 2, 2026 22:38
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from 3990b04 to 5784c6a Compare August 2, 2026 22:38
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from 32045e9 to bf26409 Compare August 3, 2026 01:38
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch 2 times, most recently from 1966859 to 238768f Compare August 3, 2026 02:26
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch 2 times, most recently from 0015963 to 32b12f4 Compare August 3, 2026 18:20
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from 238768f to 0fca217 Compare August 3, 2026 18:21
@lstein
lstein marked this pull request as ready for review August 3, 2026 18:28
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from 0fca217 to f204e11 Compare August 4, 2026 01:43
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from 32b12f4 to 2d68eb8 Compare August 4, 2026 01:43
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from f204e11 to d0c4e2e Compare August 4, 2026 05:37
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch 2 times, most recently from 312156e to 8a2e9a2 Compare August 4, 2026 14:58
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from d0c4e2e to 6c2d8df Compare August 4, 2026 14:58
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from 8a2e9a2 to c47f5ae Compare August 4, 2026 22:32
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from 6c2d8df to a423504 Compare August 4, 2026 22:32
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from c47f5ae to e239eca Compare August 5, 2026 00:31
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch 2 times, most recently from 3374c16 to ce5c18d Compare August 5, 2026 00:38
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch 2 times, most recently from 78b62a5 to a43f464 Compare August 5, 2026 01:18
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from ce5c18d to 69fa638 Compare August 5, 2026 01:18
Adds PhotoMapAI's cluster-click behavior as an opt-in mode:

- A header toggle (persisted in the widget's values) switches map clicks
  between selecting one image and selecting the clicked point's whole
  DBSCAN cluster.
- Cluster clicks multi-select the cluster in the gallery via
  setGalleryMultiSelection, ordered by distance from the clicked point
  (proximity ordering) and capped at 5000 members; the clicked image
  becomes the primary selection, so Preview follows it. Noise points fall
  back to single selection.
- The gallery's multi-selection renders on the map as a "Highlighted
  Points" trace — larger, white-outlined, between the base points and the
  gold current-image marker — regardless of where the selection was made.

Amended during the rebase onto the re-architected webv2:

- The header toggle ships through the widget implementation's
  `headerActions` slot (the old single-manifest index.ts is gone) and
  patches its persisted value via `useWorkbenchCommands().widgets
  .patchValues('image-map', ...)` instead of dispatching
  `patchWidgetValues`; IconButton/Tooltip come from `@platform/ui` and
  `WidgetViewProps` from `@workbench/widgetContracts`.
- Cluster clicks now go through `useWorkbenchCommands().gallery
  .setItemMultiSelection(itemKeys, primaryItem)`: the ordered names are
  wrapped as kind-tagged keys with `toGalleryItemKey({ kind: 'image',
  name })` (map points are always images) and the clicked image is
  hydrated through `galleryImages.resolveMany` +
  `legacyGeneratedImageToGalleryItem`, sharing the single-select path's
  monotonic click sequence. Single select (the plain-click clear) is
  unchanged: `gallery.selectItem` already collapses the multi-selection.
- The highlight overlay reads the persisted selection with
  `getPersistedSelectedGalleryItemKeys` and parses the kind-tagged keys
  back to bare image names (`parseGalleryItemKey`, images only) — on this
  architecture `selectedImageNames` stores GalleryItemKeys, not names.
- Performance baselines recaptured (build + browser, browser verified
  passing twice): the image-map implementation chunk loads at editor boot
  via the singleton host, so the header toggle and cluster wiring grow
  editor owned bytes by 65 (launchpad owned -3 minifier drift).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lstein
lstein force-pushed the feat/image-map-09-cluster-select branch from 69fa638 to f717ca1 Compare August 5, 2026 01:21
@lstein
lstein force-pushed the feat/image-map-08-live-theme branch from a43f464 to 311ecaa Compare August 5, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant