Skip to content

Commit

Permalink
feat(ToolStrip): add select tool which enables hover popup
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Sep 18, 2023
1 parent 5f97d53 commit 519a38a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/components/ToolStrip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
/>
</groupable-item>
<div class="my-1 tool-separator" />
<groupable-item v-slot:default="{ active, toggle }" :value="Tools.Select">
<tool-button
icon="mdi-cursor-default"
name="Select"
:buttonClass="['tool-btn', active ? 'tool-btn-selected' : '']"
:disabled="noCurrentImage"
@click="toggle"
/>
</groupable-item>
<groupable-item v-slot:default="{ active, toggle }" :value="Tools.Paint">
<menu-tool-button
icon="mdi-brush"
Expand Down
19 changes: 14 additions & 5 deletions src/composables/annotationTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { useCurrentImage } from '@/src/composables/useCurrentImage';
import { frameOfReferenceToImageSliceAndAxis } from '@/src/utils/frameOfReference';
import { vtkAnnotationToolWidget } from '@/src/vtk/ToolWidgetUtils/utils';
import { onVTKEvent } from '@/src/composables/onVTKEvent';
import { LPSAxis } from '../types/lps';
import { AnnotationTool, ContextMenuEvent } from '../types/annotation-tool';
import { AnnotationToolStore } from '../store/tools/useAnnotationTool';
import { getCSSCoordinatesFromEvent } from '../utils/vtk-helpers';
import { useToolStore } from '@/src/store/tools';
import { Tools } from '@/src/store/tools/types';
import { AnnotationToolStore } from '@/src/store/tools/useAnnotationTool';
import { getCSSCoordinatesFromEvent } from '@/src//utils/vtk-helpers';
import { LPSAxis } from '@/src/types/lps';
import { AnnotationTool, ContextMenuEvent } from '@/src/types/annotation-tool';
import { usePopperState } from './usePopperState';

const SHOW_OVERLAY_DELAY = 250; // milliseconds
Expand Down Expand Up @@ -173,5 +175,12 @@ export const useHover = <ToolID extends string>(
: ({ visible: false } as Info)
);

return { overlayInfo, onHover };
const toolStore = useToolStore();
const noInfoWithoutSelect = computed(() => {
if (toolStore.currentTool !== Tools.Select)
return { visible: false } as Info;
return overlayInfo.value;
});

return { overlayInfo: noInfoWithoutSelect, onHover };
};
1 change: 1 addition & 0 deletions src/store/tools/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export enum Tools {
Crosshairs = 'Crosshairs',
Crop = 'Crop',
Polygon = 'Polygon',
Select = 'Select',
}

0 comments on commit 519a38a

Please sign in to comment.