Skip to content

Commit db131cd

Browse files
munozcojourdain
authored andcommitted
fix(VtkView): make showCubeAxes show cubeAxes
1 parent 9fe6d63 commit db131cd

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/core/VtkView.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export default {
124124
props.interactorEvents,
125125
{ emit, nextTick }
126126
);
127+
view.setCubeAxesVisibility(props.showCubeAxes);
127128
const { onEnter, onLeave, onKeyUp } = enableResetCamera(view);
128129
const resizeObserver = new ResizeObserver(() => view.resize());
129130

@@ -149,12 +150,19 @@ export default {
149150
() => props.pickingModes,
150151
() => (view.pickingModes = props.pickingModes)
151152
);
153+
watch(
154+
() => props.showCubeAxes,
155+
() => view.setCubeAxesVisibility(props.showCubeAxes)
156+
);
152157

153158
provide("view", view);
154159
const { onClick, onMouseMove } = view;
155160
const resetCamera = () => view.resetCamera();
156161
const getCamera = () => view.getCamera();
157162
const setCamera = (v) => view.setCamera(v);
163+
const setCubeAxesVisibility = (v) => {
164+
props.showCubeAxes = v;
165+
};
158166
return {
159167
vtkContainer,
160168
onEnter,
@@ -164,6 +172,7 @@ export default {
164172
resetCamera,
165173
getCamera,
166174
setCamera,
175+
setCubeAxesVisibility,
167176
};
168177
},
169178
template: `

src/core/localview.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ export class ClientView {
561561
.getActors()
562562
.forEach(({ setVisibility }) => setVisibility(false));
563563

564-
this.cubeAxes.setCamera(this.activeCamera);
565564
this.renderer.addActor(this.cubeAxes);
566565

567566
const bbox = vtkBoundingBox.newInstance({ bounds: [0, 0, 0, 0, 0, 0] });
@@ -706,6 +705,15 @@ export class ClientView {
706705
}
707706
}
708707

708+
setCubeAxesVisibility(isVisible) {
709+
this.cubeAxes.setVisibility(isVisible);
710+
this.cubeAxes
711+
.getActors()
712+
.forEach(({ setVisibility }) => setVisibility(isVisible));
713+
this.cubeAxes.setCamera(isVisible ? this.activeCamera : null); // WebXRHelper compatibility (see PR #9)
714+
this.vueCtx.nextTick(this.render);
715+
}
716+
709717
updateStyle(settings) {
710718
assignManipulators(this.style, settings, this.onBoxSelectChange);
711719
}

0 commit comments

Comments
 (0)