SCENE-CE / mirador-annotation-editor

Apache License 2.0
5 stars 0 forks source link

Implement SVG Selector #41

Open geourjoa opened 6 months ago

geourjoa commented 6 months ago

Into the target form section componenet, add a spatial selector with svg.

The SVG selector has 3 tools : image

The first tool allow to select the she shape The second allow to draw selector image The last allow to delete

When saving, the IIIF Target is :

If Konva Target layer has shapes :

If Konva Target layer has only one shape and its a rectangle

Sample : image

Else Target as string

with w canvaWidth and h canvaHeight

geourjoa commented 6 months ago

Job almost done in TextCommentTemplate (need some refactoring to share code between template)

KOnva SVG export not work. I get only empty SVG file

geourjoa commented 6 months ago

Check case with no shape, one shape (rectangle), multiple shape

daxid commented 6 months ago

@geourjoa As you need a string and not a file, you can generate the data URL (that we know is working) and parse it to get the SVG that is explicit in it.

It seems dirty but honestly it has the advantage of avoiding the handling of a file so it's not that bad.

geourjoa commented 6 months ago

@geourjoa As you need a string and not a file, you can generate the data URL (that we know is working) and parse it to get the SVG that is explicit in it.

It seems dirty but honestly it has the advantage of avoiding the handling of a file so it's not that bad.

For information, I have fixed this problem by changing the save sequence.

Save the annotation Wait the save finised Close the companion window

The asynchrone saved caused problem because the stage was closed before the export.

I can choose if I export the SVG as string or as blob text.

geourjoa commented 6 months ago

In mae 1.0.3 currently support only rectangle shape