annotorious / annotorious-openseadragon

An OpenSeadragon plugin for annotating high-res zoomable images
https://annotorious.github.io
BSD 3-Clause "New" or "Revised" License
121 stars 43 forks source link

Fixes the invalid state #165

Closed IvanVas closed 1 year ago

IvanVas commented 1 year ago

The issue described here: https://matrix.to/#/!mRzqTfJoZKLxSbFGWS:gitter.im/$6raYmtiFt7Bm4oKUaWU93fbzdTIUvW5unw_Y6FZVpt4?via=gitter.im&via=matrix.org

It seems like buttons are alway true (1), it doesn’t seem to be called without button press. Please correct me if that's a wrong assumption since everything else builds around it. I tested only a small subset of cases (two tools: rect and poly).

Which means that means it can be simplified to if (!firstDragDone) Which is causing a bug according to this hypothesis. When firstDragDone is set to “true” and not cleared (when existing annotation is clicked, not new created), we’re stuck in a bad state: we always go to else in the main if in moveHandler due to firstDragDone being stuck in true.

If all above is correct, the next step would be to remove the if (!evt.buttons) altogether.

rsimon commented 1 year ago

I'm afraid this breaks the normal drawing behavior, which is pressing SHIFT and then dragging. I frankly don't know how to fix this issue in the short term, in a way that covers all cases. Might be an issue for v3 eventually. (Where nav will work in a different way.)

IvanVas commented 1 year ago

I'm afraid this breaks the normal drawing behavior, which is pressing SHIFT and then dragging. I frankly don't know how to fix this issue in the short term, in a way that covers all cases. Might be an issue for v3 eventually. (Where nav will work in a different way.)

How does it break the normal drawing behavior?

rsimon commented 1 year ago

Try holding shift on an empty region and then draggin the pointer. Desired behavior is that this starts drawing, but it now pans the image instead.