Skip to content
Snippets Groups Projects
Verified Commit de1696d2 authored by Loïs Poujade's avatar Loïs Poujade
Browse files

edition: select correct annotation

When multiples annotations sources/list are presents, selected
annotation was overwrite with undefined (cause it was not found in
following annotations lists)
parent 7af2d10f
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,13 @@ function mapStateToProps(state, { id: companionWindowId, windowId }) { ...@@ -18,12 +18,13 @@ function mapStateToProps(state, { id: companionWindowId, windowId }) {
const { annotationid } = getCompanionWindow(state, { companionWindowId, windowId }); const { annotationid } = getCompanionWindow(state, { companionWindowId, windowId });
const canvases = getVisibleCanvases(state, { windowId }); const canvases = getVisibleCanvases(state, { windowId });
let annotation; let annotation = null;
canvases.forEach((canvas) => { canvases.forEach((canvas) => {
const annotationsOnCanvas = state.annotations[canvas.id]; const annotationsOnCanvas = state.annotations[canvas.id];
Object.values(annotationsOnCanvas || {}).forEach((value, i) => { Object.values(annotationsOnCanvas || {}).forEach((value, i) => {
if (value.json && value.json.items) { if (value.json && value.json.items) {
annotation = value.json.items.find((anno) => anno.id === annotationid); const maybeAnnot = value.json.items.find((anno) => anno.id === annotationid);
if (maybeAnnot !== undefined) annotation = maybeAnnot;
} }
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment