2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

readerhighlight: fix showing anchored popup dialog

This commit is contained in:
hius07 2024-08-31 10:51:25 +03:00 committed by Frans de Jonge
parent 6f7277d269
commit 38c8d66b5b

View File

@ -1286,9 +1286,12 @@ function ReaderHighlight:_getHighlightMenuAnchor()
elseif position == "bottom" then elseif position == "bottom" then
anchor_y = self.screen_h - Size.padding.small anchor_y = self.screen_h - Size.padding.small
else -- "gesture" else -- "gesture"
local text_box = self.ui.document:getWordFromPosition(self.gest_pos).sbox local text_box = self.ui.document:getWordFromPosition(self.gest_pos)
if self.ui.paging then if text_box then
text_box = self.view:pageToScreenTransform(self.ui.paging.current_page, text_box) 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 end
if text_box == nil then return end -- fallback to "center" 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 anchor_y = text_box.y + text_box.h + Size.padding.small -- do not stick to the box