-
-
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
Bug fix: applying camera up.z vector at scene init #3256
Changes from all commits
f82007b
d8ef9eb
556268b
eb72856
789cfd9
4014c35
1ae12b3
cb6dab7
67ea429
5c3742c
3ab1b1d
5b24f51
d338058
b8da9ba
899b568
724416b
c9eed54
b65fa61
d25c335
f8bf472
6af04f2
9ef8a70
f43f944
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,31 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { | |
sceneLayoutIn, sceneLayoutOut, opts | ||
); | ||
|
||
coerce('dragmode', opts.getDfltFromLayout('dragmode')); | ||
var dragmode = opts.getDfltFromLayout('dragmode'); | ||
|
||
if(dragmode !== false) { | ||
if(!dragmode) { | ||
|
||
dragmode = 'orbit'; | ||
|
||
if(sceneLayoutIn.camera && | ||
sceneLayoutIn.camera.up) { | ||
|
||
var x = sceneLayoutIn.camera.up.x; | ||
var y = sceneLayoutIn.camera.up.y; | ||
var z = sceneLayoutIn.camera.up.z; | ||
|
||
if(!x || !y || !z) { | ||
dragmode = 'turntable'; | ||
} else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is getting better by the minute. Thanks for your efforts @archmoj Now, would there be a way to tweak this condition such that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point @etpinard. Let me check. |
||
dragmode = 'turntable'; | ||
} | ||
} else { | ||
dragmode = 'turntable'; | ||
} | ||
} | ||
} | ||
|
||
coerce('dragmode', dragmode); | ||
coerce('hovermode', opts.getDfltFromLayout('hovermode')); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,22 +42,6 @@ | |
], | ||
"layout": { | ||
"autosize": true, | ||
"undefined": { | ||
"cameraposition": [ | ||
[ | ||
0.13855639464070454, | ||
0.5365430934822464, | ||
0.7678929376547012, | ||
-0.32134727420767745 | ||
], | ||
[ | ||
0, | ||
0, | ||
0 | ||
], | ||
1.8771354322421991 | ||
] | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought this might not be necessary. If one wants to enable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow. Thanks for fixing this. That |
||
"title": "Scatter3d with text weirdness", | ||
"showlegend": false, | ||
"height": 758, | ||
|
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.
Previous calculations of
camera.up
forgl3d_surface-lighting
&gl3d_ibm-plot
didn't set up vector close to [0,0,1].I thought we may ignore camera z up if
cameraposition
depreciated setting is used.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 solution.
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.
... and I presume the
gl3d_opacity-surface.png
baseline changed because of this?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.
Ignore that last comment. I didn't see #3256 (comment)
Thanks!