-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
scattergl visible restyle fix #2442
Conversation
- refs to regl2d objects are kept even when options objects are emptied e.g. in the case of legend visible toggles, so don't try to redraw regl2d object with old options.
- use same convert routine for x and y errors, - use same reset options object when initializing and resetting scene options.
spyOn(scene.error2d, 'draw'); | ||
spyOn(scene.scatter2d, 'draw'); | ||
|
||
return Plotly.restyle(gd, 'visible', 'legendonly', [0]); |
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.
if(scene.fill2d) scene.fill2d.draw(i); | ||
if(scene.fill2d && scene.fillOptions[i]) { | ||
// must do all fills first | ||
scene.fill2d.draw(i); |
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.
Clear improvement over master
- but this does raise the question of whether this (not your change, but the structure surrounding it) is really the right behavior, particularly with fill: 'tonext'
but also with multiple fills to zero. I can try this out tomorrow and see if my interpretation of what this is doing is accurate, but In svg scatter
, each fill gets drawn below any trace that it's attached to (even the trace before it if it's a fill: 'tonext'
) but above any other trace that comes before it. If all the lines and points are above all the fills, you can get points and lines that look disconnected from their own fills.
src/traces/scattergl/attributes.js
Outdated
opacity: extendFlat({}, plotAttrs.opacity, { | ||
editType: 'calc' | ||
}), | ||
opacity: extendFlat({}, plotAttrs.opacity) |
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.
you don't even need the extendFlat
, right? overrideAll
will take care of that.
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.
done in 4776832
@@ -330,6 +274,33 @@ function sceneOptions(gd, subplot, trace, positions) { | |||
markerOptions.positions = positions; | |||
} | |||
|
|||
function makeErrorOptions(axLetter, errorOpts, vals) { |
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.
Nice!
src/traces/scattergl/index.js
Outdated
@@ -486,6 +486,22 @@ function sceneUpdate(gd, subplot) { | |||
if(!subplot._scene) { | |||
scene = subplot._scene = Lib.extendFlat({}, reset, first); | |||
|
|||
// apply new option to all regl components (used on drag) | |||
scene.update = function update(opt) { |
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.
cc @dfcreative you were right! scene.update
is still used on drag. Added spy+assertion below to 🔏 this thing down.
Dima verbally ✅ this PR to me. @alexcjohnson anything else? Your comment in #2442 (comment) probably deserved an issue of its own. |
💃 |
fixes #2441 and 🌴 a few things in
scattergl/index.js
along the way.cc @dfcreative @alexcjohnson