-
-
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
Minor fixes to allow null frames internally #1121
Conversation
fyi @rreusser you'll need to merge master to make pass again. |
@@ -2399,6 +2399,8 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) { | |||
for(i = 0; i < trans._frames.length; i++) { | |||
frame = trans._frames[i]; | |||
|
|||
if(!frame) continue; |
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.
so, technically, not just null
is special. Any non-numeric i
would make trans._frames[i]
falsy?
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.
i
can't be non-numeric since it's the array index. This is a check to see if the accessed frame is falsey. Perhaps a better check is if (!Lib.isPlainObject(frame))
.
Making I wonder though, if we could expose a way through |
Short answer… no. I don't see any way to accomplish this without structural changes to animation. As discussed previously, I think the solution would be frames that you would toggle on/off. On each data -> fullData step, it would merge any 'on' frames. Turning the frames off would restore it to the original state. |
Thanks for the reply @rreusser
This would certainly make Perhaps (or not) this could as easy as adding a |
Yeah, I think with all the other machinery in place and with a much better understanding of what we're after that this might actually not be so difficult. The reason this wasn't done to begin with is that one solution cannot handle both ephemeral update-and-forget-about-it updates and stateless toggle updates. I think it would be worthwhile though. |
Conflicts: test/jasmine/tests/animate_test.js
💃 |
This PR adds a small test and a couple fixes to prevent plotly from breaking on null frames. This is necessary for transforms that directly add or remove frames. If they remove frames, they should avoid compressing the array so that indices don't change. This means
null
orundefined
entries in the frame array should simply be ignored.