diff --git a/src/viewer.js b/src/viewer.js index 1bc23c746..31803e2d6 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -103,28 +103,28 @@ class gltfViewer const self = this; input.onRotate = (deltaX, deltaY) => { - if (self.renderingParameters.cameraIndex === "orbit camera") + if (this.userCameraActive()) { this.userCamera.rotate(deltaX, deltaY); } }; input.onPan = (deltaX, deltaY) => { - if (self.renderingParameters.cameraIndex === "orbit camera") + if (this.userCameraActive()) { this.userCamera.pan(deltaX, deltaY); } }; input.onZoom = (delta) => { - if (self.renderingParameters.cameraIndex === "orbit camera") + if (this.userCameraActive()) { this.userCamera.zoomIn(delta); } }; input.onResetCamera = () => { - if (self.renderingParameters.cameraIndex === "orbit camera") + if (this.userCameraActive()) { self.userCamera.reset(self.gltf, self.renderingParameters.sceneIndex); } @@ -309,7 +309,7 @@ class gltfViewer scene.applyTransformHierarchy(gltf); const transform = mat4.create(); - if (this.renderingParameters.cameraIndex === "orbit camera") + if (this.userCameraActive()) { const scaleFactor = getScaleFactor(gltf, this.renderingParameters.sceneIndex); mat4.scale(transform, transform, vec3.fromValues(scaleFactor, scaleFactor, scaleFactor)); @@ -371,6 +371,11 @@ class gltfViewer spinner.style.display = "none"; } } + + userCameraActive() + { + return this.userCameraActive(); + } } export { gltfViewer };