Files
Nicolò Ribaudo 38615bf67f Fix global selection event handlers abort for multiple viewers
For text selection we use some document-global event handlers to detect
when selection finishes: we cannot have them be limited to the viewer
container because one might start selection in the container but then
move the mouse outside of it before releasing it.

The global event listener will then "dispatch" the event response to
the correct `TextLayerBuilder`.

The global event listener was using the `AbortSignal` from the first
TextLayerBuilder that registered it: if two builders have two different
signals, destroying the first one would remove the global event listener
that is still needed by the second one.

This commit fixes the problem by manually listening to the
TextLayerBuilder's own abortSignal, and when it's cancelled only remove
the global event listener if there is no other TextLayerBuilder that
still needs it.
2026-11-04 11:58:55 +01:00
..