From f38013804dace8a455dd33da8dcda50d5f089c4a Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Tue, 6 Feb 2024 13:57:16 +0100 Subject: [PATCH] Support annotation edition with image --- src/annotationForm/AnnotationFormFooter.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/annotationForm/AnnotationFormFooter.js b/src/annotationForm/AnnotationFormFooter.js index 656786e..a14e76f 100644 --- a/src/annotationForm/AnnotationFormFooter.js +++ b/src/annotationForm/AnnotationFormFooter.js @@ -85,15 +85,23 @@ function AnnotationFormFooter({ const isNewAnnotation = !annotation; - // Save jpg image of the drawing in a data url - getKonvaAsDataURL(windowId).then((dataURL) => { - console.log('dataURL:', dataURL); + // TODO dumb code to avoid error from Konva export. WIth image, Konva doesnot work + if (mediaIsVideo) { + // Save jpg image of the drawing in a data url + getKonvaAsDataURL(windowId).then((dataURL) => { + console.log('dataURL:', dataURL); + const annotation = { ...annotationToSaved }; + annotation.body.id = dataURL; + saveAnnotationInEachCanvas(canvases, config, receiveAnnotation, annotation, target, isNewAnnotation); + closeFormCompanionWindow(); + resetStateAfterSave(); + }); + } else { const annotation = { ...annotationToSaved }; - annotation.body.id = dataURL; saveAnnotationInEachCanvas(canvases, config, receiveAnnotation, annotation, target, isNewAnnotation); closeFormCompanionWindow(); resetStateAfterSave(); - }); + } }; return ( -- GitLab