Skip to content

Commit

Permalink
Merge pull request #14 from piximi/bugfix/initial-annotation-click
Browse files Browse the repository at this point in the history
[mod,fix] passes default category kind if no selected category
  • Loading branch information
Andrea-Papaleo authored Jul 10, 2024
2 parents 6471b14 + aba95b9 commit 04fd14a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/hooks/useAnnotationState/useAnnotationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ export const useAnnotationState = (annotationTool: AnnotationTool) => {

const onAnnotated = useMemo(() => {
const func = () => {
dispatch(
annotatorSlice.actions.setAnnotationState({
annotationState: AnnotationState.Annotated,
kind: selectedCategory?.kind,
annotationTool,
})
);
if (selectionMode !== AnnotationMode.New) return;

if (!selectedCategory) {
if (!defaultSelectedCategory) return;
dispatch(
Expand All @@ -66,6 +60,14 @@ export const useAnnotationState = (annotationTool: AnnotationTool) => {
activeImageId!
);
}

dispatch(
annotatorSlice.actions.setAnnotationState({
annotationState: AnnotationState.Annotated,
kind: selectedCategory?.kind ?? defaultSelectedCategory?.kind,
annotationTool,
})
);
};
return func;
}, [
Expand Down

0 comments on commit 04fd14a

Please sign in to comment.