From 7bacadd1e7c3830464492d380fc172dfb218bd6a Mon Sep 17 00:00:00 2001 From: Forrest Date: Thu, 5 May 2022 16:02:42 -0400 Subject: [PATCH 1/2] fix(View): disable style when not interactive --- src/core/View.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 From fcf47af9cc3e897a050279fc9c5c48726a21dcd7 Mon Sep 17 00:00:00 2001 From: Forrest Date: Thu, 5 May 2022 16:03:26 -0400 Subject: [PATCH 2/2] fix(ViewContainer): instantiate interactor --- src/core/ViewContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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();