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

WIP saving from svg

parent 29851f95
No related branches found
No related tags found
1 merge request!10Draft: MigratingAnnotationCreation to MUI5.
Pipeline #1916 failed
...@@ -16,7 +16,6 @@ import LocalOfferIcon from '@mui/icons-material/LocalOffer'; ...@@ -16,7 +16,6 @@ import LocalOfferIcon from '@mui/icons-material/LocalOffer';
import HubIcon from '@mui/icons-material/Hub'; import HubIcon from '@mui/icons-material/Hub';
import { TabContext, TabList, TabPanel } from '@mui/lab'; import { TabContext, TabList, TabPanel } from '@mui/lab';
import AnnotationDrawing from './annotationForm/AnnotationDrawing'; import AnnotationDrawing from './annotationForm/AnnotationDrawing';
import WebAnnotation from './WebAnnotation';
import { secondsToHMS } from './utils'; import { secondsToHMS } from './utils';
import AnnotationFormContent from './annotationForm/AnnotationFormContent'; import AnnotationFormContent from './annotationForm/AnnotationFormContent';
import AnnotationFormTime from './annotationForm/AnnotationFormTime'; import AnnotationFormTime from './annotationForm/AnnotationFormTime';
...@@ -327,11 +326,6 @@ function AnnotationCreation(props) { ...@@ -327,11 +326,6 @@ function AnnotationCreation(props) {
config, config,
} = props; } = props;
// const dumbIimage = {
// id: null,
// svg,
// };
// state.image = dumbIimage;
const drawingStateSerialized = JSON.stringify(drawingState); const drawingStateSerialized = JSON.stringify(drawingState);
...@@ -349,7 +343,6 @@ function AnnotationCreation(props) { ...@@ -349,7 +343,6 @@ function AnnotationCreation(props) {
const drawingImageExport = svg; const drawingImageExport = svg;
const t = (tstart && tend) ? `${tstart},${tend}` : null; const t = (tstart && tend) ? `${tstart},${tend}` : null;
const body = { value: (!textBody.length && t) ? `${secondsToHMS(tstart)} -> ${secondsToHMS(tend)}` : textBody }; const body = { value: (!textBody.length && t) ? `${secondsToHMS(tstart)} -> ${secondsToHMS(tend)}` : textBody };
saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, drawingStateSerialized, drawingImageExport, tags); saveAnnotation(canvases, config, receiveAnnotation, annotation, body, t, xywh, image, drawingStateSerialized, drawingImageExport, tags);
props.closeCompanionWindow('annotationCreation', { props.closeCompanionWindow('annotationCreation', {
......
...@@ -126,3 +126,22 @@ const sendFile = async (fileContent) => { ...@@ -126,3 +126,22 @@ const sendFile = async (fileContent) => {
console.error('Error uploading file:', error); console.error('Error uploading file:', error);
} }
}; };
// export function dataURLtoBlob(dataurl) {
// // Split the Data URL to get the metadata and the actual data
// console.log('Data URL:', dataurl);
// var arr = dataurl.split(','),
// mime = arr[0].match(/:(.*?);/)[1], // Extract MIME type
// bstr = atob(arr[1]), // Decode base64
// n = bstr.length,
// u8arr = new Uint8Array(n); // Create a new ArrayBuffer
//
// // Convert the binary string to an ArrayBuffer
// while(n--){
// u8arr[n] = bstr.charCodeAt(n);
// }
//
// // Return a Blob object
// return new Blob([u8arr], {type:mime});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment