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

Autosave annotations when widget closes #187

Open
raulgabor opened this issue Nov 6, 2023 · 1 comment
Open

Autosave annotations when widget closes #187

raulgabor opened this issue Nov 6, 2023 · 1 comment

Comments

@raulgabor
Copy link

Hi,

I was wondering if there is any possibility in saving an annotation when the user clicks outside the widget to close it (basically it autosaves the annotation without hitting the OK button).
I've already made this work with the saveSelected() method when the user clicks outside of the OSD viewer, but I can't get it to work when the user does it inside the viewer.
Is there a way to do this or even possible?

Thanks!

@rsimon
Copy link
Member

rsimon commented Nov 6, 2023

I don't think this is actually possible right now, unfortunately. The cancelSelected event doesn't pass the latest state of the annotation, so there's no way to get a handle on it.

The only (tedious/hacky) workaround might be that you create your own 'clicktrap' - a DIV that's overlaid on top of the OpenSeadragon viewer, and which would block mouse events passing through. Then you could listen to events on that DIV, and instead save + close the editor programmatically.

Must admit I haven't thought this through completely. At least, there will be some z-index trickery required.

FWIW: Annotorious v3 (currently a separate branch in the main Annotorious repo) is almost ready to go. And it will work in a much different way. Most importantly, it will have proper state management, which would make scenarios such as yours a lot easier I think.

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