From 653b710d192fe91dc835caacfd376b3d1de0b3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Mon, 28 Aug 2023 18:32:33 +0200 Subject: [PATCH] Add double tap to deselect (#19) --- holonote/annotate/annotator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/holonote/annotate/annotator.py b/holonote/annotate/annotator.py index 4bb39a0..7362930 100644 --- a/holonote/annotate/annotator.py +++ b/holonote/annotate/annotator.py @@ -477,11 +477,19 @@ def tap_selector(x,y): # Tap tool must be enabled on the element tap_stream.add_subscriber(tap_selector) return element + def register_double_tap_clear(self, element): + def double_tap_clear(x, y): + self.clear_indicated_region() + + double_tap_stream = hv.streams.DoubleTap(source=element, transient=True) + double_tap_stream.add_subscriber(double_tap_clear) + return element def indicators(self): if self.element is not None: self.register_tap_selector(self.element) + self.register_double_tap_clear(self.element) def inner(_count): return self.static_indicators