diff --git a/src/Annotator/reducers/general-reducer.js b/src/Annotator/reducers/general-reducer.js index 33917dda..eb6c8a0a 100644 --- a/src/Annotator/reducers/general-reducer.js +++ b/src/Annotator/reducers/general-reducer.js @@ -131,10 +131,9 @@ export default (state, action) => { return produce( modifyRegion(polygon, { points: polygon.points.slice(0, -1), - editingLabels: true, open: false, }), - s => {s.mode = null} + s => {s.mode = {mode: "CLOSE_POLYGON", regionId: polygon.id}} ) } else { state = saveToHistory(state, i18next.t("move.polypoint")) @@ -319,7 +318,8 @@ export default (state, action) => { case "MOVE_POLYGON_POINT": { return {...state, mode: null} } - case "MOVE_LINE_POINT": { + case "MOVE_LINE_POINT": + case "CLOSE_POLYGON": { return produce( modifyRegion(state.mode.regionId, { editingLabels: true }), s => {s.mode = null} diff --git a/src/Localization/translation-de-DE.js b/src/Localization/translation-de-DE.js index 5e91a874..008eaa3d 100644 --- a/src/Localization/translation-de-DE.js +++ b/src/Localization/translation-de-DE.js @@ -2,6 +2,10 @@ const translationDeDE = { "menu.classifications": "Klassifizierungen", "menu.history": "Verlauf", "menu.regions": "Regionen", + "regions.lock.all": "Alle sperren", + "regions.unlock.all": "Alle entsperren", + "regions.hide.all": "Alle ausblenden", + "regions.show.all": "Alle einblenden", "error.image": "Bild konnte nicht geladen werden.", "no.history": "Kein Verlauf vorhanden", "desc.class": "Klassen", diff --git a/src/Localization/translation-en-EN.js b/src/Localization/translation-en-EN.js index b3840c35..c14c70ce 100644 --- a/src/Localization/translation-en-EN.js +++ b/src/Localization/translation-en-EN.js @@ -2,6 +2,10 @@ const translationEnEN = { "menu.classifications": "Classifications", "menu.history": "History", "menu.regions": "Regions", + "regions.lock.all": "Lock all", + "regions.unlock.all": "Unlock all", + "regions.hide.all": "Hide all", + "regions.show.all": "Show all", "error.image": "Could not load image", "no.history": "No History Yet", "desc.class": "Class", diff --git a/src/RegionSelectorSidebarBox/index.jsx b/src/RegionSelectorSidebarBox/index.jsx index 91ebcdc2..0af725a8 100644 --- a/src/RegionSelectorSidebarBox/index.jsx +++ b/src/RegionSelectorSidebarBox/index.jsx @@ -1,11 +1,12 @@ // @flow -import {memo} from "react" +import {memo, useState} from "react" import SidebarBoxContainer from "../SidebarBoxContainer" import {createTheme, styled, ThemeProvider} from "@mui/material/styles" import {grey} from "@mui/material/colors" import RegionIcon from "@mui/icons-material/PictureInPicture" import Grid from "@mui/material/Grid" +import Button from "@mui/material/Button" import TrashIcon from "@mui/icons-material/Delete" import LockIcon from "@mui/icons-material/Lock" import UnlockIcon from "@mui/icons-material/LockOpen" @@ -22,6 +23,7 @@ const theme = createTheme() const ChipSpan = styled('span')(() => styles.chip) const RowDiv = styled('div')(() => styles.row) +const ButtonRowDiv = styled('div')(() => styles.buttonRow) const ContainerDiv = styled('div')(() => styles.container) const Chip = ({color, text}) => { @@ -161,6 +163,21 @@ export const RegionSelectorSidebarBox = ({ const {t} = useTranslation(); + const [allLocked, setAllLocked] = useState(false) + const [allHidden, setAllHidden] = useState(false) + + const toggleLockAll = () => { + const next = !allLocked + setAllLocked(next) + regions.forEach((r) => onChangeRegion({...r, locked: next})) + } + + const toggleHideAll = () => { + const next = !allHidden + setAllHidden(next) + regions.forEach((r) => onChangeRegion({...r, visible: !next})) + } + return ( + + + + {regions.map((r, i) => ( svg": { + width: 16, + height: 16, + }, + }, + }, row: { padding: 4, cursor: "pointer",