From 8c00352dce8f854784919621646528468676c46b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 31 Aug 2020 15:13:21 +0530 Subject: [PATCH] Prevent selection from being cleared if handle is released after drag far away from end of selection --- src/pyj/read_book/selection_bar.pyj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/selection_bar.pyj b/src/pyj/read_book/selection_bar.pyj index 0d26a2afe4..8d5f2afd66 100644 --- a/src/pyj/read_book/selection_bar.pyj +++ b/src/pyj/read_book/selection_bar.pyj @@ -527,7 +527,10 @@ class SelectionBar: handle = self.dragging_handle self.dragging_handle = None self.state = WAITING - self.update_position(handle) + # this is done after the event loop ticks because otherwise if + # update_position moves the handle a click event is delivered to the + # container, calling container_clicked() and clearing the selection + window.setTimeout(self.update_position.bind(None, handle), 0) def mouseup_on_container(self, ev): if self.state is DRAGGING: