Skip to content

Commit

Permalink
support fallback color for updated regions
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jul 9, 2024
1 parent faf8b10 commit fb3fecf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions client/src/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ export default () => {
const mapRegionsColor = (regions) => {
if(regions === undefined) return []
return regions.map((region, index) => {
const classLabels = settingsConfig.settings.configuration.labels;
const classLabels = settings.configuration.labels.length > 0
? settings.configuration.labels
: settingsConfig.settings.configuration.labels;

const clsIndex = classLabels.findIndex(label => label.id === region.cls);
const regionColor = clsIndex < classLabels.length ? colors[clsIndex]: colors[clsIndex % colors.length]
const regionColor = clsIndex !== -1 ? (clsIndex < classLabels.length ? colors[clsIndex]: colors[clsIndex % colors.length]) : colors[0]
return {
...region,
color: regionColor
Expand Down
2 changes: 1 addition & 1 deletion client/src/SetupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
}
};
settingsConfig.changeSetting('settings',newSettings);
showAnnotationLab(newSettings)
setConfiguration({type: "UPDATE_CONFIGURATION", payload: newConfig})
showAnnotationLab(newSettings)
}
const {t} = useTranslation();

Expand Down

0 comments on commit fb3fecf

Please sign in to comment.