diff --git a/src/core/View.js b/src/core/View.js index 86503d0..cf48eb4 100644 --- a/src/core/View.js +++ b/src/core/View.js @@ -133,11 +133,9 @@ export default class View extends Component { this.openglRenderWindow = props.renderWindowView; - if (props.interactive) { - this.interactor = props.interactor; - this.defaultStyle = vtkInteractorStyleManipulator.newInstance(); - this.style = this.defaultStyle; - } + this.interactor = props.interactor; + this.defaultStyle = vtkInteractorStyleManipulator.newInstance(); + this.style = props.interactive ? this.defaultStyle : null; // Create orientation widget this.axesActor = vtkAxesActor.newInstance(); @@ -194,8 +192,10 @@ export default class View extends Component { this.debouncedCubeBounds = debounce(this.updateCubeBounds, 50); this.setInteractorStyle = (style) => { - this.style = style; - this.interactor.setInteractorStyle(style); + if (this.props.interactive) { + this.style = style; + this.interactor.setInteractorStyle(style); + } }; // Internal functions diff --git a/src/core/ViewContainer.js b/src/core/ViewContainer.js index 90bee5b..024bde6 100644 --- a/src/core/ViewContainer.js +++ b/src/core/ViewContainer.js @@ -22,6 +22,7 @@ class ViewController extends Component { } else { this.renderWindow = vtkRenderWindow.newInstance(); this.openglRenderWindow = vtkOpenGLRenderWindow.newInstance(); + this.interactor = vtkRenderWindowInteractor.newInstance(); } this.onEnter = this.onEnter.bind(this); @@ -32,7 +33,6 @@ class ViewController extends Component { if (!this.props.root) { this.renderWindow.addView(this.openglRenderWindow); - this.interactor = vtkRenderWindowInteractor.newInstance(); if (this.props.interactive) { this.interactor.setView(this.openglRenderWindow); this.interactor.initialize();