Skip to content

Commit

Permalink
fix for restyle calls
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Nov 19, 2018
1 parent 724416b commit c9eed54
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/plots/gl3d/layout/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,27 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
sceneLayoutIn.dragmode = 'turntable';
}

if(sceneLayoutIn.dragmode !== undefined) {
// Because the default is now set to orbit mode
// (i.e. in order to apply camera.z.up at init time)
// we set turnable our disarable option here.

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) {
enableTurnTable();
} else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) {
if(sceneLayoutIn.dragmode !== false) {
if(!sceneLayoutIn.dragmode) {
// Because the default is now set to orbit mode
// (i.e. in order to apply camera.z.up at init time)
// we set turnable our disarable option here.

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) {
enableTurnTable();
} else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) {
enableTurnTable();
}
} else {
enableTurnTable();
}
} else {
enableTurnTable();
}
}

Expand Down

0 comments on commit c9eed54

Please sign in to comment.