[ReaderLink, Dispatcher] add toggle for tap-to-follow links (#13469)
Some checks failed
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Has been cancelled
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Has been cancelled

closes #13381
This commit is contained in:
David
2025-04-05 15:16:17 +01:00
committed by GitHub
parent 7e12cab461
commit 68f3b347a9
2 changed files with 15 additions and 12 deletions

View File

@@ -460,15 +460,15 @@ From the footnote popup, you can jump to the footnote location in the book by sw
local footnote_popup_settings_items = {}
table.insert(menu_items.follow_links.sub_item_table, 5, {
text = _("Footnote popup settings"),
enabled_func = function()
return isFootnoteLinkInPopupEnabled() and
(isTapToFollowLinksOn() or isSwipeToFollowNearestLinkEnabled())
end,
sub_item_table = footnote_popup_settings_items,
separator = true,
})
table.insert(footnote_popup_settings_items, {
text = _("Show more links as footnotes"),
enabled_func = function()
return isFootnoteLinkInPopupEnabled() and
(isTapToFollowLinksOn() or isSwipeToFollowNearestLinkEnabled())
end,
checked_func = isPreferFootnoteEnabled,
callback = function()
G_reader_settings:saveSetting("link_prefer_footnote",
@@ -479,10 +479,6 @@ From the footnote popup, you can jump to the footnote location in the book by sw
})
table.insert(footnote_popup_settings_items, {
text = _("Use book font as popup font"),
enabled_func = function()
return isFootnoteLinkInPopupEnabled() and
(isTapToFollowLinksOn() or isSwipeToFollowNearestLinkEnabled())
end,
checked_func = function()
return G_reader_settings:isTrue("footnote_popup_use_book_font")
end,
@@ -493,10 +489,6 @@ From the footnote popup, you can jump to the footnote location in the book by sw
})
table.insert(footnote_popup_settings_items, {
text = _("Set footnote popup font size"),
enabled_func = function()
return isFootnoteLinkInPopupEnabled() and
(isTapToFollowLinksOn() or isSwipeToFollowNearestLinkEnabled())
end,
keep_menu_open = true,
callback = function()
local spin_widget
@@ -703,6 +695,15 @@ function ReaderLink:onTap(_, ges)
end
end
function ReaderLink:onToggleTapLinks()
G_reader_settings:flipNilOrTrue("tap_to_follow_links")
local tap_links_status = isTapToFollowLinksOn() and _("on") or _("off")
UIManager:show(Notification:new{
text = T(_("Tap to follow links: %1"), tap_links_status),
})
return true
end
function ReaderLink:getCurrentLocation()
return self.ui.paging and self.ui.paging:getBookLocation()
or {xpointer = self.ui.rolling:getBookLocation()}