Skip to content
Snippets Groups Projects
Commit 22269079 authored by Antoine Roy's avatar Antoine Roy
Browse files

Les titres sont pris en charge par les annotation et le panel d'annotation à...

Les titres sont pris en charge par les annotation et le panel d'annotation à bien pour titre celui de l'annotation
parent b3d0d0b4
No related branches found
No related tags found
2 merge requests!15Merge title,!10Draft: MigratingAnnotationCreation to MUI5.
Pipeline #1694 failed
...@@ -76,6 +76,8 @@ class AnnotationCreation extends Component { ...@@ -76,6 +76,8 @@ class AnnotationCreation extends Component {
} else if (body.type === 'Image') { } else if (body.type === 'Image') {
// annoState.textBody = body.value; // why text body here ??? // annoState.textBody = body.value; // why text body here ???
annoState.image = body; annoState.image = body;
} else if (body.type === "AnnotationTitle" ) {
annoState.title = body
} }
}); });
} else if (props.annotation.body.type === 'TextualBody') { } else if (props.annotation.body.type === 'TextualBody') {
...@@ -105,6 +107,7 @@ class AnnotationCreation extends Component { ...@@ -105,6 +107,7 @@ class AnnotationCreation extends Component {
annoState.xywh = geomFromAnnoTarget(props.annotation.target); annoState.xywh = geomFromAnnoTarget(props.annotation.target);
[annoState.tstart, annoState.tend] = timeFromAnnoTarget(props.annotation.target); [annoState.tstart, annoState.tend] = timeFromAnnoTarget(props.annotation.target);
} }
console.log(annoState)
} }
const toolState = { const toolState = {
...@@ -142,7 +145,7 @@ class AnnotationCreation extends Component { ...@@ -142,7 +145,7 @@ class AnnotationCreation extends Component {
...annoState, ...annoState,
valuetextTime: '', valuetextTime: '',
mediaVideo: null, mediaVideo: null,
title: '', title: 'defaultTitle',
}; };
this.submitForm = this.submitForm.bind(this); this.submitForm = this.submitForm.bind(this);
...@@ -343,7 +346,8 @@ class AnnotationCreation extends Component { ...@@ -343,7 +346,8 @@ class AnnotationCreation extends Component {
svg, svg,
tags, tags,
}).toJson(); }).toJson();
console.log(this.state.annotation);
console.log(anno);
if (annotation) { if (annotation) {
storageAdapter.update(anno) storageAdapter.update(anno)
.then((annoPage) => { .then((annoPage) => {
...@@ -428,7 +432,6 @@ class AnnotationCreation extends Component { ...@@ -428,7 +432,6 @@ class AnnotationCreation extends Component {
image, image,
valueTime, valueTime,
mediaVideo, mediaVideo,
title
} = this.state; } = this.state;
// TODO : Vérifier ce code, c'est étrange de comprarer un typeof à une chaine de caractère. // TODO : Vérifier ce code, c'est étrange de comprarer un typeof à une chaine de caractère.
...@@ -440,10 +443,9 @@ class AnnotationCreation extends Component { ...@@ -440,10 +443,9 @@ class AnnotationCreation extends Component {
const isVideoDataLoaded = mediaVideo && mediaVideo.video && !isNaN(mediaVideo.video.duration) && mediaVideo.video.duration > 0; const isVideoDataLoaded = mediaVideo && mediaVideo.video && !isNaN(mediaVideo.video.duration) && mediaVideo.video.duration > 0;
return ( return (
<CompanionWindow <CompanionWindow
title={title ? title : 'New Annotation'} title={annotation ? annotation.title : 'New Annotation'}
windowId={windowId} windowId={windowId}
id={id} id={id}
> >
......
...@@ -30,8 +30,9 @@ export default class WebAnnotation { ...@@ -30,8 +30,9 @@ export default class WebAnnotation {
/** */ /** */
createBody() { createBody() {
let bodies = []; let bodies = [];
console.log('CREATEBODY')
if (this.body && this.body.value !== '') { if (this.body && this.body.value !== '') {
console.log('TEXT BODY', this.body.value)
const textBody = { const textBody = {
type: 'TextualBody', type: 'TextualBody',
value: this.body.value, value: this.body.value,
...@@ -40,6 +41,8 @@ export default class WebAnnotation { ...@@ -40,6 +41,8 @@ export default class WebAnnotation {
} }
if (this.image) { if (this.image) {
console.log('IMAGE', this.image.id)
const imgBody = { const imgBody = {
id: this.image.id, id: this.image.id,
type: 'Image', type: 'Image',
...@@ -48,13 +51,17 @@ export default class WebAnnotation { ...@@ -48,13 +51,17 @@ export default class WebAnnotation {
} }
if(this.title){ if(this.title){
console.log('TITLE', this.title)
const title={ const title={
type: 'AnnotationTitle', type: 'AnnotationTitle',
value: this.title, value: this.title,
} }
bodies.push(title)
} }
if (this.tags) { if (this.tags) {
console.log('TAG', this.tags)
bodies = bodies.concat(this.tags.map((tag) => ({ bodies = bodies.concat(this.tags.map((tag) => ({
purpose: 'tagging', purpose: 'tagging',
type: 'TextualBody', type: 'TextualBody',
...@@ -62,8 +69,10 @@ export default class WebAnnotation { ...@@ -62,8 +69,10 @@ export default class WebAnnotation {
}))); })));
} }
if (bodies.length === 1) { if (bodies.length === 1) {
console.log('bodies',bodies)
return bodies[0]; return bodies[0];
} }
console.log('bodies',bodies)
return bodies; return bodies;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment