Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1843b1d

Browse files
committed
fixed save png orthographic plot
1 parent e97fc78 commit 1843b1d

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"gl-mat4": "^1.2.0",
8181
"gl-mesh3d": "^2.0.7",
8282
"gl-plot2d": "^1.4.2",
83-
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#827c18c2510f678e91cc680d5886f9ca523051b4",
83+
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#3d0ac91d13e879e207b3311940f4696cbb36aaa7",
8484
"gl-pointcloud2d": "^1.0.2",
8585
"gl-scatter3d": "^1.1.6",
8686
"gl-select-box": "^1.0.3",

src/plots/gl3d/scene.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,13 @@ var proto = Scene.prototype;
350350
proto.initializeGLCamera = function() {
351351

352352
var cameraData = this.fullSceneLayout.camera;
353-
var ortho = (cameraData.projection && cameraData.projection.type === 'orthographic');
353+
var isOrtho = (cameraData.projection && cameraData.projection.type === 'orthographic');
354354

355355
this.camera = createCamera(this.container, {
356356
center: [cameraData.center.x, cameraData.center.y, cameraData.center.z],
357357
eye: [cameraData.eye.x, cameraData.eye.y, cameraData.eye.z],
358358
up: [cameraData.up.x, cameraData.up.y, cameraData.up.z],
359-
ortho: ortho,
359+
_ortho: isOrtho,
360360
zoomMin: 0.01,
361361
zoomMax: 100,
362362
mode: 'orbit'
@@ -747,11 +747,19 @@ function getOrbitCamera(camera) {
747747
// getLayoutCamera :: orbit_camera_coords -> plotly_coords
748748
// inverse of getOrbitCamera
749749
function getLayoutCamera(camera) {
750+
var cameraProjectionType;
751+
if(camera._ortho === false) { cameraProjectionType = 'perspective'; }
752+
else if(camera._ortho === true) { cameraProjectionType = 'orthographic'; }
753+
else {
754+
cameraProjectionType = (camera.projection && camera.projection.type === 'orthographic') ?
755+
'orthographic' : 'perspective';
756+
}
757+
750758
return {
751759
up: {x: camera.up[0], y: camera.up[1], z: camera.up[2]},
752760
center: {x: camera.center[0], y: camera.center[1], z: camera.center[2]},
753761
eye: {x: camera.eye[0], y: camera.eye[1], z: camera.eye[2]},
754-
projection: {type: (camera.projection && camera.projection.type === 'orthographic') ? 'orthographic' : 'perspective'}
762+
projection: {type: cameraProjectionType}
755763
};
756764
}
757765

0 commit comments

Comments
 (0)