Skip to content

fix(figure-editor): always render the default unzoomed view#298

Open
peymanvahidi wants to merge 2 commits into
mainfrom
fix/figure-editor-default-view
Open

fix(figure-editor): always render the default unzoomed view#298
peymanvahidi wants to merge 2 commits into
mainfrom
fix/figure-editor-default-view

Conversation

@peymanvahidi

Copy link
Copy Markdown
Collaborator

What & why

When you zoom into the scatter plot and then open the figure editor, the editor showed the zoomed view — but its zoom-inset tool assumes the plot is sitting at its default, fit-all extent. So the inset's source rectangle mapped to the wrong data region and rendered points you never selected (#294). It only behaved if you hadn't zoomed beforehand.

The root cause is that the editor captures the plot through the same offscreen path as a PNG export, and that path replays the live d3 zoom/pan transform. The inset, meanwhile, derives its data region from the full data extent. Zoomed in, the two disagree.

The fix makes the figure editor always capture the default view — the same thing a double-click reset shows — no matter how the live plot happens to be zoomed at the time.

A sibling issue surfaced alongside it (#297): zooming into a region and then isolating left the old transform in place, so the isolated subset rendered under a stale view instead of filling the plot.

What changed

  • Capture pathrenderToCanvas (and captureAtResolution above it) take a resetView flag; when set, they render with an identity transform instead of the live one. The figure editor passes it at all three capture sites — the live preview, the export, and each geometric zoom-inset render — so the main plot and its insets agree on the default extent again.
  • IsolationisolateSelection() and resetIsolation() now reset the zoom after reprocessing, mirroring the existing "data changed → reset view" behavior. Entering an isolated subset, or leaving it, snaps back to the full view ([BUG] When zooming to a specifc region and isolating the view should reset to the full view #297).

How it stays safe

  • resetView defaults to false, so the plain "export current view" path (export-utils) is untouched — it still captures exactly what's on screen.
  • When the live plot isn't zoomed, the live transform is identity, so the new path is byte-for-byte the old behavior for the case that already worked — existing tests and the e2e figure-editor specs stay valid.
  • New unit tests pin both directions of the flag at the renderer seam and its wiring through the compositor and modal, plus the isolate / reset-isolation zoom resets. The full core suite (1246 tests), type-check, and lint are green.

Fixes #294, #297

Editor now ignores the live transform and renders the fit-all view at all capture sites via a resetView flag; also resets zoom on isolation enter/exit to prevent stale state. Closes #294, #297
Duplicate-stack badges were captured at the live zoom position; added captureBadges(transform) to re-render them at the identity transform alongside the fit-all points during captureAtResolution.
@peymanvahidi peymanvahidi requested a review from tsenoner June 26, 2026 14:37
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.

[BUG] Figure editor's Zoom Inset is broken when you already zoomed in scatterplot

1 participant