-
-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: preserve z-indexed subplots during relayout 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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Fix pan/zoom failing on first interaction when traces have different `zorder` values [[#7659](https://github.com/plotly/plotly.js/pull/7659)] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,7 @@ var Color = require('../components/color'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var BADNUM = require('../constants/numerical').BADNUM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var axisIDs = require('./cartesian/axis_ids'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var cartesianConstants = require('./cartesian/constants'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var clearOutline = require('../components/shapes/handle_outline').clearOutline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var scatterAttrs = require('../traces/scatter/layout_attributes'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -895,6 +896,19 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Preserve z-indexed subplots (e.g. 'xyz2', 'xyz3') from oldSubplots to _plots only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // These are created by drawFramework when traces have different zorder values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // We preserve them to _plots (not _subplots.cartesian) so that drag/pan operations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // in dragbox.js can still transform them during relayout operations that don't | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // trigger a full redraw (e.g., resize). If drawFramework runs later, it will | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // properly update/remove these subplots as needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var zindexSeparator = cartesianConstants.zindexSeparator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for(var oldId in oldSubplots) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(oldId.indexOf(zindexSeparator) !== -1 && !newSubplots[oldId]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| newSubplots[oldId] = oldSubplots[oldId]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+899
to
+910
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prodded Claude to dig into this and this is the resulting solution. Updating this one file should take care of the issue without updating dragbox.js. Could you give this change a shot and let me know if it fixes your problem?
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // while we're at it, link overlaying axes to their main axes and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // anchored axes to the axes they're anchored to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var axList = axisIDs.list(mockGd, null, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file can remain unchanged if you follow the suggestion in plots.js.