ReaderFooter: Fix the madness related to its hold footer

Namely, instead of making it lower priority than readerhighlight and
hoping for the best, make it higher priority, as it should (ReaderFooter
itself is *above* Reader, after all), with a sane set of fallthroughs:

* No footer
* No hold-to-skim
* Held outside the footer (but inside the footer tap zone)

This made the crap workaround from #7466 unnecessary, and actually fixes
the behavior in PDFs (because readerhighlight will match the *physical*
page, which may include off-screen content) and ePubs w/r eclaim bar
height (in which case, there's actual content behind the footer that
readerhighlight could have matched on).

Fix #7697
reviewable/pr7711/r1
NiLuJe 3 years ago
parent 056eeef747
commit 8d3aacbac3

@ -718,10 +718,11 @@ function ReaderFooter:setupTouchZones()
id = "readerfooter_hold", id = "readerfooter_hold",
ges = "hold", ges = "hold",
screen_zone = footer_screen_zone, screen_zone = footer_screen_zone,
handler = function() return self:onHoldFooter() end, handler = function(ges) return self:onHoldFooter(ges) end,
-- (Low priority: word lookup and text selection overrides = {
-- have priority - SkimTo widget can be more easily "readerhighlight_hold",
-- brought up via some other gestures) },
-- (High priority: it's a fallthrough if we held outside the footer)
}, },
}) })
end end
@ -2163,18 +2164,23 @@ function ReaderFooter:onTapFooter(ges)
return true return true
end end
function ReaderFooter:onHoldFooter() function ReaderFooter:onHoldFooter(ges)
-- We're lower priority than readerhighlight_hold, which means it's already been tripped by the time we got here. -- We're higher priority than readerhighlight_hold, so, make sure we fall through properly...
-- If it actually had something to do, ReaderHighlight would have stopped propagating the event, if not self.settings.skim_widget_on_hold then
-- so we can safely clear ReaderHighlight state here, otherwise it'll get confused on the next tap... return
-- (c.f., #7464) end
self.ui.highlight:clear() if not self.view.footer_visible then
if self.mode == self.mode_list.off then return end return
if self.settings.skim_widget_on_hold then end
if not self.footer_content.dimen or not self.footer_content.dimen:contains(ges.pos) then
-- We held outside the footer: meep!
return
end
-- We're good, make sure we stop the event from going to readerhighlight_hold
self.ui:handleEvent(Event:new("ShowSkimtoDialog")) self.ui:handleEvent(Event:new("ShowSkimtoDialog"))
return true return true
end end
end
function ReaderFooter:refreshFooter(refresh, signal) function ReaderFooter:refreshFooter(refresh, signal)
self:updateFooterContainer() self:updateFooterContainer()

@ -215,9 +215,6 @@ function ReaderHighlight:setupTouchZones()
screen_zone = { screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1, ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
}, },
overrides = {
"readerfooter_hold",
},
handler = function(ges) return self:onHold(nil, ges) end handler = function(ges) return self:onHold(nil, ges) end
}, },
{ {

Loading…
Cancel
Save