Skip to content

Commit e0dba37

Browse files
committed
refactor(cine): expose slice from useViewLocator
Each tool was destructuring {locator, frame} from useViewLocator and then re-deriving slice via locatorPatch(locator.value).slice. The composable already computes slice internally; surface it directly so the three tool files drop a redundant computed each.
1 parent a7558a2 commit e0dba37

4 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/components/tools/polygon/PolygonTool.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ export default defineComponent({
178178
const activeToolStore = useActiveToolStore();
179179
const { activeLabel } = storeToRefs(activeToolStore);
180180
181-
const { locator, frame } = useViewLocator(viewId, imageId);
182-
const slice = computed(() => locatorPatch(locator.value).slice);
181+
const { locator, frame, slice } = useViewLocator(viewId, imageId);
183182
184183
const { metadata: imageMetadata } = useImage(imageId);
185184
const isToolActive = computed(() => toolStore.currentTool === toolType);

src/components/tools/rectangle/RectangleTool.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export default defineComponent({
7171
const activeToolStore = useActiveToolStore();
7272
const { activeLabel } = storeToRefs(activeToolStore);
7373
74-
const { locator, frame } = useViewLocator(viewId, imageId);
75-
const slice = computed(() => locatorPatch(locator.value).slice);
74+
const { locator, frame, slice } = useViewLocator(viewId, imageId);
7675
7776
const { currentImageID } = useCurrentImage();
7877
const isToolActive = computed(() => toolStore.currentTool === toolType);

src/components/tools/ruler/RulerTool.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ export default defineComponent({
6666
const rulerStore = useRulerStore();
6767
const { activeLabel } = storeToRefs(rulerStore);
6868
69-
const { locator, frame } = useViewLocator(viewId, imageId);
70-
const slice = computed(() => {
71-
const patch = locatorPatch(locator.value);
72-
return patch.slice;
73-
});
69+
const { locator, frame, slice } = useViewLocator(viewId, imageId);
7470
7571
useImage(imageId);
7672
const isToolActive = computed(() => toolStore.currentTool === Tools.Ruler);

src/composables/useViewLocator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ export function useViewLocator(
3434
})
3535
);
3636

37-
return { locator, frame };
37+
return { locator, frame, slice };
3838
}

0 commit comments

Comments
 (0)