diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index 24e98ee3c71c302abd26a891cfaa28f08da8479a..009c035d26758835733b47d42dec80d25eac3158 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -332,7 +332,7 @@ function AnnotationCreation(props) { const t = (tstart && tend) ? `${tstart},${tend}` : null; const body = { value: (!textBody.length && t) ? `${secondsToHMS(tstart)} -> ${secondsToHMS(tend)}` : textBody }; - saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, konvaThing, svg, tags); + saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, drawingStateSerialized, svg, tags); props.closeCompanionWindow('annotationCreation', { id, diff --git a/src/AnnotationCreationUtils.js b/src/AnnotationCreationUtils.js index 956cde332c00d6c5d3c41e73c9f150f0304f191b..966f7a66c7022ca4e10fc18748fc7f353458d424 100644 --- a/src/AnnotationCreationUtils.js +++ b/src/AnnotationCreationUtils.js @@ -56,7 +56,7 @@ export async function getSvg(windowId) { return svg; }; -export function saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, konvaThing, svg, tags){ +export function saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, drawingStateSerialized, svg, tags){ // TODO promises not handled. Use promiseAll ? canvases.forEach(async (canvas) => { const storageAdapter = config.annotation.adapter(canvas.id); @@ -69,7 +69,7 @@ export function saveAnnotation(canvases, config, receiveAnnotation, annotation, }, id: (annotation && annotation.id) || `${uuid()}`, image, - konvaThing, + drawingStateSerialized, manifestId: canvas.options.resource.id, svg, tags, diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index 6a2135af367b45b17aa7115b52060f88826f13fa..09984de891df1e750ea37b7213f987777da3bbcd 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -2,7 +2,7 @@ export default class WebAnnotation { /** */ constructor({ - canvasId, id, fragsel, image, body, tags, svg, manifestId, konvaThing + canvasId, id, fragsel, image, body, tags, svg, manifestId, drawingStateSerialized }) { this.id = id; this.canvasId = canvasId; @@ -12,7 +12,9 @@ export default class WebAnnotation { this.svg = svg; this.image = image; this.manifestId = manifestId; - this.konvaThing = konvaThing; + this.drawingState = drawingStateSerialized; + + console.log('WebAnnotation constructor', this); } /** */ @@ -23,7 +25,7 @@ export default class WebAnnotation { motivation: 'commenting', target: this.target(), type: 'Annotation', - konvaThing: this.konvaThing + drawingStateSerialized: this.drawingStateSerialized, }; } @@ -43,17 +45,18 @@ export default class WebAnnotation { const imgBody = { id: this.image.id, type: 'Image', + format: 'image/svg+xml', }; bodies.push(imgBody); } - if (this.tags) { - bodies = bodies.concat(this.tags.map((tag) => ({ - purpose: 'tagging', - type: 'TextualBody', - value: tag, - }))); - } + // if (this.tags) { + // bodies = bodies.concat(this.tags.map((tag) => ({ + // purpose: 'tagging', + // type: 'TextualBody', + // value: tag, + // }))); + // } if (bodies.length === 1) { return bodies[0]; }