annotorious / annotorious-v2-plugins

Plugins compatible with the RecogitoJS, Annotorious and AnnotoriousOSD annotation libraries
BSD 3-Clause "New" or "Revised" License
29 stars 19 forks source link

Fixed size rectangles #9

Open m1stermanager opened 3 years ago

m1stermanager commented 3 years ago

I think I can hack together something for this, but it would be great if I could force certain annotations to be a fixed size. In our use case, we want to have very very consistent image tags, so removing the user's ability to set or resize would be great.

I would picture it as a button outside of the annotation where I can programmatically include an annotation config option with height, width, and resizable on options?

if resize is false AND:

if resize is true and either is set, it is the initial value but can be changed.

If you think this would be useful I would actually love to attempt to contribute a change for it.

The workaround I can think of now is subscribing to an event, seeing if the annotation label matches one of our fixed size options, and forcing the size in the event the user has attempted to resize.

rsimon commented 3 years ago

I agree, this could be useful to others. I wouldn't see it as a core feature though. IMO this would work really well as a plugin.

The workaround you're suggesting would currently work I think. It's not possible to update the shape programmatically while the annotation is being edited. The way to do it would be to write your own tool (something like a "Fixed Size Rectangle Tool" plugin). That would take pre-set width and height as config options, and only allow move when it's being edited, but not resize.

The Selector Pack provides a basic framework + examples for how to build tool plugins. The original rectangle plugin is part of the core codebase here, and should be reusable almost completely.

m1stermanager commented 3 years ago

awesome. thanks for the quick reply. I'll take some time to look into this. this is a super cool project and your responsiveness is WILD.

let me poke around a bit and see if I can come up with something! I may have a little time this weekend to get my feet wet, but my schedule is a little crazy sometimes