Closed shameerasl closed 6 months ago
hi @shameerasl , can you please help me with annotations saving in the database and later on retrieving it ? like how you implemented this ?
You should be able to load a state file via a app.loadURLs
.
got the following error when trying to load the state from the db :-
Error fetching annotations: TypeError: Cannot read properties of undefined (reading 'split')
at on.loadURLs (dwv.min.js:1:378291)
at Vn.loadURLs (dwv.min.js:1:450130)
at applauncher.js:254:15
here is my code , please let me know if i am doing something wrong over here :-
dbRef.once('value')
.then(function (snapshot) {
const annotations = snapshot.val();
if (annotations) {
const drawings = JSON.parse(annotations);
myapp.loadURLs(drawings);
}
})
.catch(function (error) {
console.error('Error fetching annotations:', error);
});
app.loadURLs
takes the url of a state file. If you want to process the request as you do in your example, you can pass the JSON string directly to app.applyJsonState(annotations)
.
i was getting the following error :-
Error fetching annotations: TypeError: Cannot read properties of undefined (reading 'getActiveViewLayer')
at At.apply (dwv.min.js:1:347437)
at Vn.applyJsonState (dwv.min.js:1:454413)
at applauncher.js:254:15
but i applied a timer to delay the loading of the annotations , and it has solved my problem :)
thanks alot for your help :)
Closing for now, feel free to comment if you need.
i was able to draw and save annoattions in the database. but i cannot select and edit the drawings after fetched from database. even i cant able to select the draw. how this problem can be solved? Thanks in advance