Skip to content

Commit

Permalink
fix(RulerWidget2D): init visible states
Browse files Browse the repository at this point in the history
  • Loading branch information
floryst committed Sep 18, 2023
1 parent 279b625 commit 8c2af00
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/tools/ruler/RulerWidget2D.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import vtkRulerWidget, {
InteractionState,
vtkRulerViewWidget,
vtkRulerWidgetState,
} from '@/src/vtk/RulerWidget';
import vtkWidgetManager from '@kitware/vtk.js/Widgets/Core/WidgetManager';
import {
Expand Down Expand Up @@ -170,11 +171,16 @@ export default defineComponent({
secondPoint: false,
});
const widgetState = widgetFactory.getWidgetState();
onVTKEvent(widgetFactory.getWidgetState(), 'onModified', () => {
const updateVisibleState = (widgetState: vtkRulerWidgetState) => {
visibleStates.firstPoint = widgetState.getFirstPoint().getVisible();
visibleStates.secondPoint = widgetState.getSecondPoint().getVisible();
});
};
const widgetState = widgetFactory.getWidgetState();
onVTKEvent(widgetFactory.getWidgetState(), 'onModified', () =>
updateVisibleState(widgetState)
);
updateVisibleState(widgetState);
return {
ruler,
Expand Down

0 comments on commit 8c2af00

Please sign in to comment.