Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: preserve z-indexed subplots duringrelayout for correct pan/zoom#7659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ryan-williams wants to merge2 commits intoplotly:master
base:master
Choose a base branch
Loading
fromrunsascoded:fix-zorder-pan

Conversation

@ryan-williams
Copy link

@ryan-williamsryan-williams commentedNov 28, 2025
edited
Loading

Summary

Fixes a bug where pan/zoom fails on thefirst interaction when traces have differentzorder values. On first drag,one trace moves with the grid while the other stays frozen in place. Thesecond pan (and all subsequent pans) work correctly — both traces move together as expected. This is particularly noticeable in react-plotly.js, which callsPlotly.Plots.resize() after mount.

Root cause: Whenrelayout is called (e.g., during resize),supplyDefaults resets_plots vialinkSubplots, losing z-indexed subplots (e.g.,xyz2,xyz3). Sincerelayout doesn't triggerdrawFramework, they aren't recreated, causingupdateSubplots indragbox.js to miss them during pan/zoom.

Fix:

  • InlinkSubplots (plots.js): preserve z-indexed subplots fromoldSubplots
  • InupdateSubplots (dragbox.js): include z-indexed subplots from_plots

Demo

bug.mp4

Live before/after comparison:https://runsascoded.github.io/plotly.js/

To reproduce the bug:

  1. Open theBefore Fix demo
  2. Drag the chart to pan horizontally
  3. First drag: one trace (blue) moves with the grid, but the other trace (red) stays frozen
  4. Release and drag again
  5. Second drag: both traces move correctly together
  6. Compare withAfter Fix — first drag works correctly

Test plan

  • Existingcartesian_interact tests pass
  • Manual testing with react-plotly.js confirms fix
  • CI tests

🤖 Generated withClaude Code

ryan-williamsand others added2 commitsNovember 27, 2025 18:28
When traces have different `zorder` values, plotly.js creates z-indexedsubplots (e.g., `xyz2`, `xyz3`) in `drawFramework`. However, when`relayout` is called (e.g., during resize), `supplyDefaults` resets`_plots` via `linkSubplots`, losing these z-indexed subplots. Since`relayout` doesn't trigger `drawFramework`, they aren't recreated.This caused pan/zoom to fail on the first attempt in react-plotly.js,because `updateSubplots` in `dragbox.js` couldn't find the z-indexedsubplots to transform.Fix:1. In `linkSubplots`, preserve z-indexed subplots from `oldSubplots`2. In `updateSubplots`, include z-indexed subplots from `_plots`🤖 Generated with [Claude Code](https://claude.com/claude-code)Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@ryan-williams

[8]ページ先頭

©2009-2025 Movatter.jp