diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index 009c035d26758835733b47d42dec80d25eac3158..d228815f0cf650bca98a045b0cecf2b9d36e7b12 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -95,6 +95,10 @@ function AnnotationCreation(props) { annoState.xywh = geomFromAnnoTarget(props.annotation.target); [tstart, tend] = timeFromAnnoTarget(props.annotation.target); } + + if(props.annotation.drawingState) { + setDrawingState(JSON.parse(props.annotation.drawingState)); + } } // If we don't have tstart setted, we are creating a new annotation. diff --git a/src/AnnotationCreationUtils.js b/src/AnnotationCreationUtils.js index 966f7a66c7022ca4e10fc18748fc7f353458d424..4cf911067a44f13960f58c9d580912d67e493690 100644 --- a/src/AnnotationCreationUtils.js +++ b/src/AnnotationCreationUtils.js @@ -53,6 +53,7 @@ export function isShapesTool(activeTool) { export async function getSvg(windowId) { const stage = window.Konva.stages.find((s) => s.attrs.id === windowId); const svg = await exportStageSVG(stage, false); // TODO clean + console.log('SVG:', svg); return svg; }; diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index 09984de891df1e750ea37b7213f987777da3bbcd..2267a985f1d1e5c567716789cc3d130dafdeaac4 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -10,7 +10,8 @@ export default class WebAnnotation { this.body = body; this.tags = tags; this.svg = svg; - this.image = image; + //this.image = image; + this.image = null; this.manifestId = manifestId; this.drawingState = drawingStateSerialized; @@ -19,14 +20,16 @@ export default class WebAnnotation { /** */ toJson() { - return { + const result = { body: this.createBody(), id: this.id, motivation: 'commenting', target: this.target(), type: 'Annotation', - drawingStateSerialized: this.drawingStateSerialized, + drawingState: this.drawingState, }; + console.log('WebAnnotation toJson', result); + return result; } /** */ @@ -41,13 +44,20 @@ export default class WebAnnotation { } if (this.image) { - + // TODO dumb image { this.image.id} const imgBody = { - id: this.image.id, + id: 'https://tetras-libre.fr/themes/tetras/img/logo.svg', type: 'Image', format: 'image/svg+xml', }; - bodies.push(imgBody); + //bodies.push(imgBody); + const testImageBody = { + "id": "http://iiif.tetras-libre.fr/data/Hakanai/media/10_HKN-Garges_A2B4243.JPG", + "type": "Image", + "format": "image/jpg", + "value": "<a href=\"http://iiif.tetras-libre.fr/data/Hakanai/media/10_HKN-Garges_A2B4243.JPG\" target=\"_blank\">Dispositif</a>" + }; + bodies.push(testImageBody); } // if (this.tags) {