emigre / openseadragon-annotations

Draw annotations over deep zoom images
BSD 3-Clause "New" or "Revised" License
97 stars 40 forks source link

Add: (get/set) (color/class/mode) #31

Open mnasan opened 2 years ago

magednasan commented 2 years ago

New functions are added to this plugin: viewer.annotations.get_color(): return the current stroke's color for annotations. viewer.annotations.set_color(c): set a color for the next annotation, c can be a string like 'red', 'blue', .. or '#FF0000' format. viewer.annotations.get_mode(): return the current mode of the viewer, it can be either {'DRAW' or 'MOVE'}. viewer.annotations.set_mode(): set the mode of the viewer to {'DRAW' or 'MOVE'}, this function takes only those two string values as input. viewer.annotations.set_class(): set a specific HTML class for each annotation (in the <path> tag). New style can be added to specific annotation based on class name. (We are assuming to draw several annotations in different colors and different classes). viewer.annotations.get_class(): return the current active class the is used for drawing.

iangilman commented 2 years ago

I don't have the power to merge things here, and I'm not sure if @Emigre is still maintaining this project, but I thought I'd add my two cents:

For starters, I think it's awesome that you've added all these new features! Definitely seems more powerful.

Secondly, though, looking at the changes, it looks like there are quite a number of changes that are unrelated to these new features... Looks like a complete overhaul of the plugin! Typically, with a pull request it's good to focus on just one feature at a time, and at the very least to explain what all the changes are for.

Thirdly, I think function names like getColor would be more in-line with the OSD naming convention, if you wanted to match that in this plugin.

Anyway, of course it's up to @Emigre how they want to proceed. Even if they aren't still maintaining the project, it's good to have this PR here so that it can help other people who want these features!

If it does turn out @Emigre has abandoned this repo, you might consider making your version an official fork. We can update http://openseadragon.github.io/#plugins to point to it.

emigre commented 2 years ago

hey guys hi. I've been absent for a while, but to be honest this plugin has been the last of the priorities in my life for a while - I was thiking on getting rid of it somehow, to be honest. @iangilman thanks for keeping an eye, you are really great, I'm amazed that you've maintained the attention on the plugin for so long. Very nice of you.

@magednasan thanks for the contribution, but, as @iangilman was saying, there is a lot of stuff here, some of them are changes that are not heading in the direction I had in mind. As an example, I did not have in mind to support bower. Also the change seems unrelated to the rest. All I'm sayin is, you are adding several things in one go.

I really don't know what would be the best way to handle this. In my mind I was going to remove preact from this plugin and implement something simpler to update the SVG. I had an idea on how to do this, which would end up with the plugin not depending on any library. I'll have ot think what to do.

emigre commented 2 years ago

@iangilman as the "guardian"of the OpenSeadragon ecosystem, perhaps you have ideas on what would be the best? Feel free to email me or contact me in any way if you want to discuss, be involved or advice. Cheers.

emigre commented 2 years ago

To give you both some context around this, I created this as a mindless experiment years ago with no particular intention. I didn't add unit tests, I did not use TypeScript, I used an already existing rendering library... In short I didn't think about it too much. But then over time I've received a number of PRs to it. It seems that some people are actually interested in the plugin. To my surprise!....

iangilman commented 2 years ago

@Emigre Good to hear from you! Yes, there certainly does seem to be interest in this plugin! I think the big annotation option for OSD is https://github.com/recogito/annotorious-openseadragon but I think this plugin has a lot of appeal because it's simpler and doesn't depend on other things, so I think there's value in both.

I would certainly be happy if you wanted to continue to support and evolve this plugin. If @magednasan's changes aren't to your liking, it's your perogative to reject this PR or ask for changes to it. You should definitely take it in whatever direction you feel is best! Of course if you don't want to continue to maintain it, maybe making an announcement in the issues or the readme saying you're looking for a new maintainer would be good.

I'm curious to hear what @magednasan thinks... If they want to pick up the torch, or if they're happy to leave it as it is.