informatics-isi-edu / openseadragon-viewer

2D viewer with openseadragon
Apache License 2.0
5 stars 2 forks source link

Cancel edit annotation #47

Closed rastogi-bhavya closed 4 years ago

rastogi-bhavya commented 4 years ago

Resolution of #42

The solution works as follows. First, when the Edit button is clicked, the program creates a copy of the annotation (an SVG file) by calling the exportToSVG function. When the Back button is clicked, the annotations that was edited is removed and then re-loaded using the copy that was created earlier. This makes sure that the state of the SVG is consistent.

One improvement that can be made is that, when the back button is clicked, I could check to see if any changes have been made to the annotation, before removing the annotation and re-loading it. This could save some time as it would remove unnecessary file handling, but increase the time in comparison of the two files (copy of the original annotation and current annotation).

RFSH commented 4 years ago

@rastogi-bhavya alongside svgID in both cases I'm also sending the groupID. So you should change both of your functions to take that into account. You don't need to save/discard all the groups in that svg file