Closed Dzeri96 closed 1 year ago
Hi,
thanks for the message! Just to confirm: this will always fire when a selection has ended, correct? Regardless of whether the selection has ended by creating a new shape, or by canceling the selection (because the rectangle was too small). And in the case a new selection is created, the event sequence would be startSelection
-> endSelection
-> selectionCreated
?
To be honest, I forgot everything about this codebase. I'll have to get back into it this week.
After looking at the code again, yes, it seems that the endSelection
event gets triggered always. The chain of events would actually be startSelection
-> endSelection
and then either complete
, which triggers selectionCreated
, or cancel
, which does nothing as far as I understand.
Merged this now - thanks!
Great, but we shouldn't forget to add the documentation!
This is needed because even though
startSelection
always fires from the MouseTracker, thecancel
event inTool
is basically ignored. This makescancelSelected
andcreateSelection
work unreliably as indicators that drawing of a very small rectangle has ended. This new event only fires ifstartSelection
has previously fired.TODO: Add documentation
It could be that this PR belongs in the base Annotorious repo. I need it in my fork of Annotorious-openseadragon, but I'll be happy to open it there also.