readerhighlight: fix showing anchored popup dialog

reviewable/pr12369/r3
hius07 3 weeks ago committed by Frans de Jonge
parent 6f7277d269
commit 38c8d66b5b

@ -1286,10 +1286,13 @@ function ReaderHighlight:_getHighlightMenuAnchor()
elseif position == "bottom" then
anchor_y = self.screen_h - Size.padding.small
else -- "gesture"
local text_box = self.ui.document:getWordFromPosition(self.gest_pos).sbox
if self.ui.paging then
local text_box = self.ui.document:getWordFromPosition(self.gest_pos)
if text_box then
text_box = text_box.sbox
if text_box and self.ui.paging then
text_box = self.view:pageToScreenTransform(self.ui.paging.current_page, text_box)
end
end
if text_box == nil then return end -- fallback to "center"
anchor_y = text_box.y + text_box.h + Size.padding.small -- do not stick to the box
if anchor_y + dialog_box.h <= self.screen_h - Size.padding.small then -- enough room below box with gest_pos

Loading…
Cancel
Save