fix(figure-editor): always render the default unzoomed view#298
Open
peymanvahidi wants to merge 2 commits into
Open
fix(figure-editor): always render the default unzoomed view#298peymanvahidi wants to merge 2 commits into
peymanvahidi wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
renderToCanvas(andcaptureAtResolutionabove it) take aresetViewflag; 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.isolateSelection()andresetIsolation()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
resetViewdefaults tofalse, so the plain "export current view" path (export-utils) is untouched — it still captures exactly what's on screen.Fixes #294, #297