Footnotes: fix current link being unhighlight in some cases

When a link is covered by the footnote widget, we highlight it
again when closing the footnote, and schedule an unhighlight
0.5s later.
When we tap on another footnote link, this was happening too
but the unhighlight unhighlighted all, including the new
footnote link.
This disable the former when the latter happens.
This commit is contained in:
poire-z
2018-10-12 17:53:25 +02:00
parent 9d8531a4b5
commit 1b3d974bec
2 changed files with 17 additions and 7 deletions

View File

@@ -1016,6 +1016,7 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
-- (which might not be seen when covered by FootnoteWidget)
local close_callback = nil
if link.from_xpointer then -- coherent xpointer
self.ui.document:highlightXPointer() -- clear any previous one
self.ui.document:highlightXPointer(link.from_xpointer)
UIManager:setDirty(self.dialog, "ui")
close_callback = function(footnote_height)
@@ -1055,10 +1056,14 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
UIManager:close(popup)
self:onGotoLink(link, neglect_current_location)
end,
on_tap_close_callback = function(arg, ges)
-- on tap outside, see if we are tapping on another footnote,
on_tap_close_callback = function(arg, ges, footnote_height)
-- On tap outside, see if we are tapping on another footnote,
-- and display it if we do (avoid the need for 2 taps)
self:onTap(arg, ges)
if not self:onTap(arg, ges) then
-- If we did tap on another link, onTap has already cleared our
-- highlight. If not, call close_callback to unhighlight it.
close_callback(footnote_height)
end
end,
dialog = self.dialog,
}