[FootnoteWidget]: NT use buttons to move to prev/next footnote (#15911)

This commit is contained in:
David authored and GitHub committed 2026-08-23 14:39:24 +01:00
1 parent fc88887662
commit 8aa7b93d7c
2 files changed
+29 -4

No files matched your search

@@ -1611,6 +1611,15 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
end
self._footnote_popup_discard_previous_close_callback = nil
end,
navigate_footnote_callback = function(direction)
UIManager:close(popup)
if direction > 0 then
self:onSelectNextPageLink()
else
self:onSelectPrevPageLink()
end
self:onGotoSelectedPageLink()
end,
dialog = self.dialog,
}
UIManager:show(popup)
+20 -4
View File
@@ -134,6 +134,7 @@ local FootnoteWidget = InputContainer:extend{
follow_callback = nil,
on_tap_close_callback = nil,
close_callback = nil,
navigate_footnote_callback = nil,
dialog = nil,
covers_footer = true,
}
@@ -203,10 +204,13 @@ function FootnoteWidget:init()
}
end
if Device:hasKeys() then
self.key_events = {
Close = { { Device.input.group.Back } },
Follow = { { "Press" } },
}
self.key_events.Close = { { Device.input.group.Back } }
self.key_events.Follow = { { "Press" } }
if Device:hasScreenKB() or Device:hasKeyboard() then
local modifier = Device:hasScreenKB() and "ScreenKB" or "Shift"
self.key_events.NextFootnote = { { modifier, Device.input.group.PgFwd } }
self.key_events.PrevFootnote = { { modifier, Device.input.group.PgBack } }
end
end
-- Workaround bugs in MuPDF:
@@ -411,6 +415,18 @@ function FootnoteWidget:onFollow()
end
end
function FootnoteWidget:onNextFootnote()
if not self.navigate_footnote_callback then return false end
self.navigate_footnote_callback(1)
return true
end
function FootnoteWidget:onPrevFootnote()
if not self.navigate_footnote_callback then return false end
self.navigate_footnote_callback(-1)
return true
end
function FootnoteWidget:onTapClose(arg, ges)
if ges.pos:notIntersectWith(self.container.dimen) then
UIManager:close(self)