Skip to content
Snippets Groups Projects
Commit bd700549 authored by Anthony's avatar Anthony
Browse files

WIP Saving fake data + recover last data from drawing

parent a6e095fa
Branches
No related tags found
1 merge request!10Draft: MigratingAnnotationCreation to MUI5.
...@@ -95,6 +95,10 @@ function AnnotationCreation(props) { ...@@ -95,6 +95,10 @@ function AnnotationCreation(props) {
annoState.xywh = geomFromAnnoTarget(props.annotation.target); annoState.xywh = geomFromAnnoTarget(props.annotation.target);
[tstart, tend] = timeFromAnnoTarget(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. // If we don't have tstart setted, we are creating a new annotation.
......
...@@ -53,6 +53,7 @@ export function isShapesTool(activeTool) { ...@@ -53,6 +53,7 @@ export function isShapesTool(activeTool) {
export async function getSvg(windowId) { export async function getSvg(windowId) {
const stage = window.Konva.stages.find((s) => s.attrs.id === windowId); const stage = window.Konva.stages.find((s) => s.attrs.id === windowId);
const svg = await exportStageSVG(stage, false); // TODO clean const svg = await exportStageSVG(stage, false); // TODO clean
console.log('SVG:', svg);
return svg; return svg;
}; };
......
...@@ -10,7 +10,8 @@ export default class WebAnnotation { ...@@ -10,7 +10,8 @@ export default class WebAnnotation {
this.body = body; this.body = body;
this.tags = tags; this.tags = tags;
this.svg = svg; this.svg = svg;
this.image = image; //this.image = image;
this.image = null;
this.manifestId = manifestId; this.manifestId = manifestId;
this.drawingState = drawingStateSerialized; this.drawingState = drawingStateSerialized;
...@@ -19,14 +20,16 @@ export default class WebAnnotation { ...@@ -19,14 +20,16 @@ export default class WebAnnotation {
/** */ /** */
toJson() { toJson() {
return { const result = {
body: this.createBody(), body: this.createBody(),
id: this.id, id: this.id,
motivation: 'commenting', motivation: 'commenting',
target: this.target(), target: this.target(),
type: 'Annotation', type: 'Annotation',
drawingStateSerialized: this.drawingStateSerialized, drawingState: this.drawingState,
}; };
console.log('WebAnnotation toJson', result);
return result;
} }
/** */ /** */
...@@ -41,13 +44,20 @@ export default class WebAnnotation { ...@@ -41,13 +44,20 @@ export default class WebAnnotation {
} }
if (this.image) { if (this.image) {
// TODO dumb image { this.image.id}
const imgBody = { const imgBody = {
id: this.image.id, id: 'https://tetras-libre.fr/themes/tetras/img/logo.svg',
type: 'Image', type: 'Image',
format: 'image/svg+xml', 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) { // if (this.tags) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment