Skip to content

Commit faf8b10

Browse files
committed
fix region selector keeps changing issue
1 parent c641b7d commit faf8b10

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

client/src/Annotator/index.jsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,14 @@ export const Annotator = ({
177177
if (selectedImage === undefined) return
178178

179179
const { multipleRegionLabels, multipleRegions } = settings?.configuration || {};
180-
const hasSingleRegion = state.images?.[selectedImage]?.regions?.length === 1;
181-
const disableSelection = (hasSingleRegion && !multipleRegionLabels) || (hasSingleRegion && !multipleRegions);
182-
183-
dispatchToReducer({
184-
type: "DISABLE_SELECT_TOOL",
185-
selectedTool: disableSelection ? [] : selectedTool
186-
})
180+
const hasRegions = state.images?.[selectedImage]?.regions?.length >= 1;
181+
const disableSelection = (hasRegions && !multipleRegionLabels) || (hasRegions && !multipleRegions);
182+
if(disableSelection){
183+
dispatchToReducer({
184+
type: "DISABLE_SELECT_TOOL",
185+
selectedTool: disableSelection ? [] : selectedTool
186+
})
187+
}
187188

188189
dispatchToReducer({
189190
type: "SELECT_IMAGE",

client/src/SetupPage/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
7878
}
7979
};
8080
settingsConfig.changeSetting('settings',newSettings);
81+
showAnnotationLab(newSettings)
8182
setConfiguration({type: "UPDATE_CONFIGURATION", payload: newConfig})
8283
}
8384
const {t} = useTranslation();

0 commit comments

Comments
 (0)