gl2d data-referenced annotations#1301
Conversation
- call it when ticks require a change and when user drags and scroll on plot
| }; | ||
|
|
||
| var relayoutCallback = function(scene) { | ||
| this.graphDiv._fullLayout = fullLayout; |
There was a problem hiding this comment.
this seems a bit scary - why is this necessary? I'm just worried that if gd._fullLayout and scene.fullLayout have diverged, there could somehow be changes in gd._fullLayout that this will throw away.
There was a problem hiding this comment.
I believe the problem is in the doModebar relayout shortcut.
I'll double-check why the _fullLayout gets lost. Thanks for the headsup!
There was a problem hiding this comment.
would it be an option to not use this.fullLayout at all, but only to use this.graphDiv._fullLayout?
There was a problem hiding this comment.
That's an idea.
So, the _fullLayout gets lost in Plots.supplyDefaults. We could add a block handling refs on scene objects similar to this one for cartesian axes. But I think we could do better.
The reason the lost of reference only affects dragmode relayouts is because all other relayout calls pass through scene2d.plot which update the fullLayout ref here on every pass.
There was a problem hiding this comment.
alright, well I'm not entirely sure what would happen, but the test would be something like:
- do a relayout that causes a new
gd._fullLayoutto be constructed bysupplyDefaultsbut DOESN'T result in a newscene2d.plot(like what? change legend background color? change something cosmetic on an axis of a different subplot?) - trigger this code by changing dragmode
- do something else that causes a full plot redraw (maybe just
Plotly.redraw(gd)) - does the initial relayout get reverted?
There was a problem hiding this comment.
Here's the cleanest way (I think) of updating gd._fullLayout._plots.xy._scene2d.fullLayout
There was a problem hiding this comment.
yeah, that seems better, thanks.
- this is probably a leftover from an old merge conflict
- as the full Plots.supplyDefaults is called before the doModeBar subroutine.
- scene2d.updateRefs is now called on scene2d.plot and during Plots.supplyDefaults, ensuring that scene2d.fullLayout is up-to-date with gd._fullLayout.
- call after each mouse-change / wheel-change, as opposed to each time the scene2d ticks changed (which didn't cover all the cases) - make sure gl2d pan test `mouseup` to trigger relayoutCallback
Improvement in how gl2d refs to fullLayout are updated
set to ✔️ one item on #130
TODO: