From dc9a13864b16b8130531a220a5c9694f2186b310 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 23 Feb 2021 09:57:30 +0530 Subject: [PATCH] E-book viewer: Fix selection popup bar sometimes going off screen when dragging up to the top line of text. Fixes #1915685 [ebook-viewer: Selection dialog may render partway off-screen](https://bugs.launchpad.net/calibre/+bug/1915685) --- src/pyj/read_book/selection_bar.pyj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyj/read_book/selection_bar.pyj b/src/pyj/read_book/selection_bar.pyj index edd88a42a6..ad1e325f7a 100644 --- a/src/pyj/read_book/selection_bar.pyj +++ b/src/pyj/read_book/selection_bar.pyj @@ -751,7 +751,7 @@ class SelectionBar: has_space_below = end.y + end.height < container.offsetHeight - bar_height - buffer put_below = has_space_below else: - has_space_above = end.y + bar_height - buffer > 0 + has_space_above = end.y - bar_height - buffer > 0 put_below = not has_space_above top = place_vertically(end.y + end.height if put_below else end.y, put_below)