Skip to content

Commit e2d5ec2

Browse files
authored
Merge pull request #60 from Kitware/fix-interaction
Fix interaction
2 parents f6e5f27 + fcf47af commit e2d5ec2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/core/View.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,9 @@ export default class View extends Component {
133133

134134
this.openglRenderWindow = props.renderWindowView;
135135

136-
if (props.interactive) {
137-
this.interactor = props.interactor;
138-
this.defaultStyle = vtkInteractorStyleManipulator.newInstance();
139-
this.style = this.defaultStyle;
140-
}
136+
this.interactor = props.interactor;
137+
this.defaultStyle = vtkInteractorStyleManipulator.newInstance();
138+
this.style = props.interactive ? this.defaultStyle : null;
141139

142140
// Create orientation widget
143141
this.axesActor = vtkAxesActor.newInstance();
@@ -194,8 +192,10 @@ export default class View extends Component {
194192
this.debouncedCubeBounds = debounce(this.updateCubeBounds, 50);
195193

196194
this.setInteractorStyle = (style) => {
197-
this.style = style;
198-
this.interactor.setInteractorStyle(style);
195+
if (this.props.interactive) {
196+
this.style = style;
197+
this.interactor.setInteractorStyle(style);
198+
}
199199
};
200200

201201
// Internal functions

src/core/ViewContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ViewController extends Component {
2222
} else {
2323
this.renderWindow = vtkRenderWindow.newInstance();
2424
this.openglRenderWindow = vtkOpenGLRenderWindow.newInstance();
25+
this.interactor = vtkRenderWindowInteractor.newInstance();
2526
}
2627

2728
this.onEnter = this.onEnter.bind(this);
@@ -32,7 +33,6 @@ class ViewController extends Component {
3233
if (!this.props.root) {
3334
this.renderWindow.addView(this.openglRenderWindow);
3435

35-
this.interactor = vtkRenderWindowInteractor.newInstance();
3636
if (this.props.interactive) {
3737
this.interactor.setView(this.openglRenderWindow);
3838
this.interactor.initialize();

0 commit comments

Comments
 (0)