Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding two separate distinct svg Annotations #198

Open
abhinav2712 opened this issue Apr 10, 2024 · 1 comment
Open

Adding two separate distinct svg Annotations #198

abhinav2712 opened this issue Apr 10, 2024 · 1 comment

Comments

@abhinav2712
Copy link

Lets say I hace defined one w3cAnno1 like this:

const w3cAnno1 = {
     id: Date.now(), // Unique ID for the first annotation
     type: "Annotation",
     target: {
       selector: {
         conformsTo: "http://www.w3.org/TR/media-frags/",
         type: "SvgSelector",
         value: `<svg><polygon points='100,360 423,360 432,932 100,932 100,360'></polygon></svg>`,
       },
     },
   };

here, I can save only one polygon on osd if i use addAnnotation , what if I want to save two distinct separate polygons on osd at once?
I tried defining w3cAnno2 like:

const w3cAnno2 = {
      id: Date.now(), // Unique ID for the second annotation
      type: "Annotation",
      target: {
        selector: {
          conformsTo: "http://www.w3.org/TR/media-frags/",
          type: "SvgSelector",
          value: `<svg><polygon points='500,360 923,360 932,932 500,932 500,360'></polygon></svg>`, // Example points for the second polygon
        },
      },
    };

then tried to save both of them:

annotorious.addAnnotation(w3cAnno2, true);
 annotorious.addAnnotation(w3cAnno1, true);

but this doesnt work.... anyone have possible solution?

@abhinav2712 abhinav2712 changed the title In svgSelector type of w3cAnno, can we add two separate distinct polygons on OSD? Adding two separate distinct svg Annotations Apr 10, 2024
@Whao510
Copy link

Whao510 commented Apr 25, 2024

let annotationList = [{},{},{},....]
annotationList.forEach(item=>{ anno.addAnnotation(item) });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants