Skip to content

Commit

Permalink
feat(polygons): make merge key configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Jul 2, 2024
1 parent c4ede9b commit bac2f77
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/tools/polygon/PolygonTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
import AnnotationContextMenu from '@/src/components/tools/AnnotationContextMenu.vue';
import AnnotationInfo from '@/src/components/tools/AnnotationInfo.vue';
import { useFrameOfReference } from '@/src/composables/useFrameOfReference';
import { actionToKey } from '@/src/composables/useKeyboardShortcuts';
import { Maybe } from '@/src/types';
import { useSliceInfo } from '@/src/composables/useSliceInfo';
import { useMagicKeys, watchImmediate } from '@vueuse/core';
Expand Down Expand Up @@ -126,7 +127,9 @@ export default defineComponent({
placingTool.remove();
});
const { v: mergeKey } = useMagicKeys();
const keys = useMagicKeys();
const mergeKey = computed(() => keys[actionToKey.value.mergeNewPolygon]);
const onToolPlaced = () => {
if (imageId.value) {
const newToolId = placingTool.id.value;
Expand Down
2 changes: 2 additions & 0 deletions src/composables/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ export const ACTION_TO_FUNC = {
decrementLabel: applyLabelOffset(-1),
incrementLabel: applyLabelOffset(1),

mergeNewPolygon: () => {}, // no-op

showKeyboardShortcuts,
} as const satisfies Record<Action, () => void>;
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export const ACTION_TO_KEY = {
crosshairs: 'c',
crop: 'b',
polygon: 'g',
mergeNewPolygon: 'g',
select: 's',

decrementLabel: 'q',
Expand Down
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export const ACTIONS = {
readable: 'Activate next Label',
},

mergeNewPolygon: {
readable: 'Hold down to merge new polygon with overlapping polygons',
},

showKeyboardShortcuts: {
readable: 'Show keyboard shortcuts dialog',
},
Expand Down

0 comments on commit bac2f77

Please sign in to comment.