From e3ab0aa9f9abcc0599ca72c8ef729e3993e317a7 Mon Sep 17 00:00:00 2001 From: Forrest Date: Sat, 9 Sep 2023 11:01:29 -0400 Subject: [PATCH] feat(polygon): separate out placing polygon --- .../tools/polygon/PlacingPolygonWidget2D.vue | 152 ++++++++++++++++++ src/components/tools/polygon/PolygonSVG2D.vue | 3 +- src/components/tools/polygon/PolygonTool.vue | 140 +++++----------- .../tools/polygon/PolygonWidget2D.vue | 76 +++------ src/components/tools/polygon/common.ts | 34 ++++ .../tools/ruler/PlacingRulerWidget2D.vue | 4 +- src/composables/annotationTool.ts | 1 + src/vtk/PolygonWidget/behavior.ts | 20 +-- src/vtk/PolygonWidget/common.ts | 2 + src/vtk/PolygonWidget/index.d.ts | 12 +- src/vtk/PolygonWidget/index.js | 5 +- src/vtk/PolygonWidget/standaloneState.js | 35 ++++ .../PolygonWidget/{state.ts => storeState.ts} | 18 ++- src/vtk/RulerWidget/behavior.ts | 4 +- src/vtk/ToolWidgetUtils/common.ts | 1 + 15 files changed, 326 insertions(+), 181 deletions(-) create mode 100644 src/components/tools/polygon/PlacingPolygonWidget2D.vue create mode 100644 src/components/tools/polygon/common.ts create mode 100644 src/vtk/PolygonWidget/common.ts create mode 100644 src/vtk/PolygonWidget/standaloneState.js rename src/vtk/PolygonWidget/{state.ts => storeState.ts} (92%) diff --git a/src/components/tools/polygon/PlacingPolygonWidget2D.vue b/src/components/tools/polygon/PlacingPolygonWidget2D.vue new file mode 100644 index 000000000..60b419442 --- /dev/null +++ b/src/components/tools/polygon/PlacingPolygonWidget2D.vue @@ -0,0 +1,152 @@ + + + diff --git a/src/components/tools/polygon/PolygonSVG2D.vue b/src/components/tools/polygon/PolygonSVG2D.vue index bcc5e6d82..4d5ffc87d 100644 --- a/src/components/tools/polygon/PolygonSVG2D.vue +++ b/src/components/tools/polygon/PolygonSVG2D.vue @@ -37,6 +37,7 @@ import { watch, inject, } from 'vue'; +import { Maybe } from '@/src/types'; const POINT_RADIUS = 10; const FINISHABLE_POINT_RADIUS = 16; @@ -53,7 +54,7 @@ export default defineComponent({ required: true, }, movePoint: { - type: Array as unknown as PropType, + type: Array as unknown as PropType>, }, placing: { type: Boolean, diff --git a/src/components/tools/polygon/PolygonTool.vue b/src/components/tools/polygon/PolygonTool.vue index 7284e495e..3a241fd37 100644 --- a/src/components/tools/polygon/PolygonTool.vue +++ b/src/components/tools/polygon/PolygonTool.vue @@ -5,12 +5,19 @@ v-for="tool in tools" :key="tool.id" :tool-id="tool.id" - :is-placing="tool.id === placingToolID" :current-slice="currentSlice" :view-id="viewId" :view-direction="viewDirection" :widget-manager="widgetManager" @contextmenu="openContextMenu(tool.id, $event)" + /> + @@ -19,35 +26,25 @@