-
-
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
Refactor gl3d scene #4360
Refactor gl3d scene #4360
Conversation
- make use of new gl-plot3d setters - reduce passing arguments
…Plot functions method of Scene object - i.e. to avoid passing extra this argument - also let's use scene. instead of this. in Scene methods
src/plots/gl3d/scene.js
Outdated
@@ -97,7 +97,7 @@ proto.tryCreatePlot = function() { | |||
gl: scene.gl, | |||
glOptions: { | |||
preserveDrawingBuffer: isMobile, | |||
premultipliedAlpha: true, | |||
premultipliedAlpha: false, |
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.
Hmm. Does this lead to any changes in performance ?
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.
Good question. It shouldn't. Anyway I would double check.
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.
We decided not to change this config in this PR for now: ade22a6.
Is the only change in the WebGL config the |
Yes that is the only change in the config. |
Also added a codepen to the PR description to help compare the two options. |
Then in order to keep the best view and consistent png results we could default |
@etpinard all the tests passed and this PR should be ready to merge. |
glOptions: { | ||
preserveDrawingBuffer: isMobile, | ||
premultipliedAlpha: true, | ||
antialias: 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.
Can I ask why you're now passing these options from plotly.js? The corresponding option object current on master is:
var glplotOptions = {
canvas: canvas,
gl: gl,
container: scene.container,
axes: scene.axesOptions,
spikes: scene.spikeOptions,
pickRadius: 10,
snapToData: true,
autoScale: true,
autoBounds: false,
cameraObject: cameraObject,
pixelRatio: pixelRatio
};
that is, the glOptions
container is new.
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.
Where is that set on master?
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.
plotly.js/src/plots/gl3d/scene.js
Lines 201 to 213 in 8122c21
var glplotOptions = { | |
canvas: canvas, | |
gl: gl, | |
container: scene.container, | |
axes: scene.axesOptions, | |
spikes: scene.spikeOptions, | |
pickRadius: 10, | |
snapToData: true, | |
autoScale: true, | |
autoBounds: false, | |
cameraObject: cameraObject, | |
pixelRatio: pixelRatio | |
}; |
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.
https://github.com/gl-vis/gl-plot3d/blob/d206f1f110d427b2baae0462964bc59cf7f59dae/scene.js#L80-L87
The glOptions
used to be left undefined and hidden to plolty.js
developers.
Now that are explicitly defined, it should be easier to figure out what the differences between static & interactive plots are.
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.
Ok, that's fair. But then is-mobile
becomes a top-level dependency for plotly.js and we should add it to our package.json
.
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.
Good catch. OK if I add it to package.json
?
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.
OK if I add it to
package.json
yes please!
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.
Simply listed in ff2ecc7.
But also noticed that it was added in package-lock before which is not clear why?
75de9e5dea
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.
But also noticed that it was added in package-lock before which is not clear why?
Yeah it was in the package-lock before, because the package-lock lists all the dependencies not just the top-level ones. It's a best practice to include all the top-level dependencies in the package.json, and make npm handles the nested dependencies part in the package-lock.
💃 - nicely done! Before merging, could you change the PR title to something like "Refactor gl3d scene" as this PR no longer disables |
This PR adds setters to
gl-plot3d
and refactors functions/methods ofgl3d/scene.js
file to usegl-plot3d
functions to change camera attributes and avoid two camera instances, etc.@plotly/plotly_js
Please review this PR commit by commit.
After all, this PR does NOT f_i_x #4236 by passing a different config (premultipliedAlpha: false) to
gl-plot3d
module. As used to be suggested in this demo {to compare before and after effects on Windows(7/10) using Chrome/Firefox/Opera as well as on Ubuntu using Firefox}.That may be addressed in separated PR in future.