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

Annotation can be saved but some data are undefined

parent 983dcb82
Branches
No related tags found
2 merge requests!28Resolve "Sauvegarder une annotation",!10Draft: MigratingAnnotationCreation to MUI5.
Pipeline #1884 failed
...@@ -108,6 +108,7 @@ function AnnotationCreation(props) { ...@@ -108,6 +108,7 @@ function AnnotationCreation(props) {
tstart, tstart,
valueTime: [0, 1], valueTime: [0, 1],
valuetextTime: '', valuetextTime: '',
textBody: '',
}; };
}); });
...@@ -316,41 +317,41 @@ function AnnotationCreation(props) { ...@@ -316,41 +317,41 @@ function AnnotationCreation(props) {
receiveAnnotation, receiveAnnotation,
config, config,
} = props; } = props;
const svg = <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle fill="red" cx="50" cy="50" r="50"/></svg> const svg = <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle fill="red" cx="50" cy="50" r="50" /></svg>;
const dummyAnnot = { // const dummyAnnot = {
title: 'dummyTitle', // title: 'dummyTitle',
textBody:'dummyTextBody', // textBody:'dummyTextBody',
image:{ // image:{
// id: null,
// svg: svg
// },
// tags: null,
// xywh:"220,470,450,50",
// tstart: 1880,
// tend:1905,
// textEditorStateBustingKey:0,
// konvaThing: ['SOME KONVA THING', 'AND ANOTHER KONVA THING', {thirdKonvaThing:'Third Konva thing here'}]
// }
// const title = dummyAnnot.title
const dumbIimage = {
id: null, id: null,
svg: svg svg,
}, };
tags: null, //
xywh:"220,470,450,50", // const konvaThing = dummyAnnot.konvaThing;
tstart: 1880, state.image = dumbIimage;
tend:1905, state.konvaThing = ['SOME KONVA THING', 'AND ANOTHER KONVA THING', { thirdKonvaThing: 'Third Konva thing here' }];
textEditorStateBustingKey:0,
konvaThing: ['SOME KONVA THING', 'AND ANOTHER KONVA THING', {thirdKonvaThing:'Third Konva thing here'}] const {
} textBody,
const title = dummyAnnot.title tags,
const textBody = dummyAnnot.textBody xywh,
const image = dummyAnnot.image; tstart,
const tags = dummyAnnot.tags; tend,
const xywh = dummyAnnot.xywh; image,
const tstart = dummyAnnot.tstart; konvaThing,
const tend = dummyAnnot.tend; } = state;
const textEditorStateBustingKey = dummyAnnot.textEditorStateBustingKey;
const konvaThing = dummyAnnot.konvaThing;
// const {
// title,
// textBody,
// image,
// tags,
// xywh,
// tstart,
// tend,
// textEditorStateBustingKey,
// } = state;
// TODO rename variable for better comprenhension // TODO rename variable for better comprenhension
// const svg = await getSvg(); // const svg = await getSvg();
...@@ -371,7 +372,6 @@ function AnnotationCreation(props) { ...@@ -371,7 +372,6 @@ function AnnotationCreation(props) {
manifestId: canvas.options.resource.id, manifestId: canvas.options.resource.id,
svg, svg,
tags, tags,
title,
konvaThing, konvaThing,
}).toJson(); }).toJson();
if (annotation) { if (annotation) {
...@@ -389,7 +389,7 @@ function AnnotationCreation(props) { ...@@ -389,7 +389,7 @@ function AnnotationCreation(props) {
props.closeCompanionWindow('annotationCreation', { props.closeCompanionWindow('annotationCreation', {
id, id,
position: 'right', position: 'right',
}) });
// TODO this create a re-render too soon for react and crash the app // TODO this create a re-render too soon for react and crash the app
setState({ setState({
image: { id: null }, image: { id: null },
...@@ -397,7 +397,6 @@ function AnnotationCreation(props) { ...@@ -397,7 +397,6 @@ function AnnotationCreation(props) {
tend: 0, tend: 0,
textBody: '', textBody: '',
textEditorStateBustingKey: textEditorStateBustingKey + 1, textEditorStateBustingKey: textEditorStateBustingKey + 1,
title: '',
tstart: 0, tstart: 0,
xywh: null, xywh: null,
}); });
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
export default class WebAnnotation { export default class WebAnnotation {
/** */ /** */
constructor({ constructor({
canvasId, id, fragsel, image, body, tags, svg, manifestId, title, konvaThing canvasId, id, fragsel, image, body, tags, svg, manifestId, konvaThing
}) { }) {
this.title = title,
this.id = id; this.id = id;
this.canvasId = canvasId; this.canvasId = canvasId;
this.fragsel = fragsel; this.fragsel = fragsel;
...@@ -46,13 +45,6 @@ export default class WebAnnotation { ...@@ -46,13 +45,6 @@ export default class WebAnnotation {
}; };
bodies.push(imgBody); bodies.push(imgBody);
} }
if(this.title){
const title={
type: 'AnnotationTitle',
value: this.title,
}
bodies.push(title)
}
if(this.konvaThing){ if(this.konvaThing){
const konvaThing={ const konvaThing={
...@@ -61,7 +53,6 @@ export default class WebAnnotation { ...@@ -61,7 +53,6 @@ export default class WebAnnotation {
} }
bodies.push(konvaThing) bodies.push(konvaThing)
} }
if (this.tags) { if (this.tags) {
bodies = bodies.concat(this.tags.map((tag) => ({ bodies = bodies.concat(this.tags.map((tag) => ({
purpose: 'tagging', purpose: 'tagging',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment