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)

This commit is contained in:
Kovid Goyal 2021-02-23 09:57:30 +05:30
parent 6e73715533
commit dc9a13864b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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)