-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Promise returns before rendering gl traces? #122
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
Comments
@mewalig could you share an example (with jsbin/jsfiddle/codepen) so we can take a look? It's possible it's an error with how promises are resolved. |
@mewalig Please read the contributor's guide before opening issues in this repo. |
@mdtusz: attached is a self-contained example based on the example referenced in the stack overflow page. Just change ".txt" to ".html" and view in browser. The alert pops up before the image is rendered. I will put an example on codepen later-- I don't have an account there so have to take a few more steps to get the example up there. |
This looks like a webgl only problem. Changing the title to reflect this. |
This is definitely a bug. The problem is that the plots are getting redrawn only once their A simple solution would be to force a synchronous redraw, as done by the Scene 2D: https://github.com/plotly/plotly.js/blob/master/src/plots/gl2d/scene2d.js#L168-L170 If we just move those lines to the end of their respective plot methods I think this should solve the problem. Thoughts @etpinard ? |
@mikolalysenko (cc @mdtusz ) I've tried to add Things are looking promising. But not perfect yet it seems. It looks like forcing the redraw in the plot routine does remove the lag between the time where the promise is returned and the time of first rendering. But, in order to interact with the rendered scene, a timeout of 0 ms is required. I'm testing the behavior using one of our karma/jasmine test suite. If you want try things out, the command is: npm run test-jasmine -- tests/gl_plot_interact_test.js where we simulate a mouse over event on the scene. I wonder if this behavior is related to: http://stackoverflow.com/questions/779379/why-is-settimeoutfn-0-sometimes-useful |
The reason the Using either |
Does anyone familiar with the bowels of plotly know the answer to this question which is detailed at http://stackoverflow.com/questions/34315834/plotly-js-how-to-run-my-javascript-only-after-plot-image-is-loaded?
I am aware that this list is for feature requests and bugs, and as far as I can tell now, it is either a) a bug in the behavior of the promise execution, or b) a feature request asking for an alternative mechanism to run some javascript after the plot renders, or c) just a question about an already-supported feature to which I don't know the correct answer.
Unfortunately, I don't know if it is a), b), or c) until the question is answered, so in case it is a) or b), I am posting the question here as well.
Thank you
The text was updated successfully, but these errors were encountered: