annotorious / annotorious-v1

Project has moved to http://github.com/annotorious/annotorious
https://annotorious.com
MIT License
593 stars 142 forks source link

Issue using Fancybox and Polygon on the same image #195

Open arvitl opened 6 years ago

arvitl commented 6 years ago

Hi,

I am evaluating you tool for some dev work. I want to provide users the option to draw box(es) or polygon(s) on an image for annotations. It works fine if I switch from box to ploygon and then to box. However, if I want to change to polygon after that (box --> ploygon --> box --> polygon OR ploygon --> box --> polygon), the polygon drawing on the screen behaves in a weird manner. I have buttons on the page for the users to click on to choose drawing box or polygon. Following is the code to change the shape.

   if (annotateShape == 'polygon') {
      anno.addPlugin('PolygonSelector', { activate: true });
    }
    else {
      anno.addPlugin('FancyBoxSelector', { activate: true });
    }

Could you please let me know if this is the only way.

Also, is there a way to remove an added plugin? I tried: anno.addPlugin('PolygonSelector', { activate: false });, but it did not work.

Thanks in advance

wuliupo commented 5 years ago

Yes, I also have the problem "how to disable an plugin" . If you have that solution, could you please tell me how to do? Thank you @arvitl !

wuliupo commented 5 years ago

@arvitl I have a solution! you can rest the anno before add plugin.


anno.reset();
if (annotateShape == 'polygon') {
    anno.addPlugin('PolygonSelector', { activate: true });
} else {
    anno.addPlugin('FancyBoxSelector', { activate: true });
}

It works.