New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: conflict horizontal edge gesture with link swipe #5189
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ local ButtonDialogTitle = require("ui/widget/buttondialogtitle") | |
local ConfirmBox = require("ui/widget/confirmbox") | ||
local Device = require("device") | ||
local Event = require("ui/event") | ||
local Geom = require("ui/geometry") | ||
local GestureRange = require("ui/gesturerange") | ||
local InfoMessage = require("ui/widget/infomessage") | ||
local InputContainer = require("ui/widget/container/inputcontainer") | ||
local LinkBox = require("ui/widget/linkbox") | ||
|
@@ -26,7 +24,34 @@ local ReaderLink = InputContainer:new{ | |
|
||
function ReaderLink:init() | ||
if Device:isTouchDevice() then | ||
self:initGesListener() | ||
self.ui:registerTouchZones({ | ||
{ | ||
id = "tap_link", | ||
ges = "tap", | ||
screen_zone = { | ||
ratio_x = 0, ratio_y = 0, | ||
ratio_w = 1, ratio_h = 1, | ||
}, | ||
overrides = { | ||
"tap_forward", | ||
"tap_backward", | ||
}, | ||
handler = function(ges) return self:onTap(_, ges) end, | ||
}, | ||
{ | ||
id = "swipe_link", | ||
ges = "swipe", | ||
screen_zone = { | ||
ratio_x = 0, ratio_y = 0, | ||
ratio_w = 1, ratio_h = 1, | ||
}, | ||
overrides = { | ||
"paging_swipe", | ||
"rolling_swipe" | ||
}, | ||
handler = function(ges) return self:onSwipe(_, ges) end, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That new one might also need some override (paging_swipe, rolling_swipe...) I guess. |
||
}, | ||
}) | ||
end | ||
self.ui:registerPostInitCallback(function() | ||
self.ui.menu:registerToMainMenu(self) | ||
|
@@ -48,33 +73,6 @@ function ReaderLink:onReadSettings(config) | |
self.location_stack = {} | ||
end | ||
|
||
function ReaderLink:initGesListener() | ||
if Device:isTouchDevice() then | ||
self.ges_events = { | ||
Tap = { | ||
GestureRange:new{ | ||
ges = "tap", | ||
range = Geom:new{ | ||
x = 0, y = 0, | ||
w = Screen:getWidth(), | ||
h = Screen:getHeight() | ||
} | ||
} | ||
}, | ||
Swipe = { | ||
GestureRange:new{ | ||
ges = "swipe", | ||
range = Geom:new{ | ||
x = 0, y = 0, | ||
w = Screen:getWidth(), | ||
h = Screen:getHeight(), | ||
} | ||
} | ||
}, | ||
} | ||
end | ||
end | ||
|
||
local function isTapToFollowLinksOn() | ||
return G_reader_settings:nilOrTrue("tap_to_follow_links") | ||
end | ||
|
@@ -375,13 +373,6 @@ function ReaderLink:showLinkBox(link, allow_footnote_popup) | |
end | ||
end | ||
|
||
function ReaderLink:onSetDimensions(dimen) | ||
-- update listening according to new screen dimen | ||
if Device:isTouchDevice() then | ||
self:initGesListener() | ||
end | ||
end | ||
|
||
function ReaderLink:onTap(_, ges) | ||
if not isTapToFollowLinksOn() then return end | ||
if self.ui.document.info.has_pages then | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it also overrides the ones that
overrides_vertical_edge
does?And both
overrides_vertical_edge
andoverrides_horizontal_edge
might also need to overridereaderconfigmenu_swipe
andreadermenu_swipe
(they may not overlap as DTAP_ZONE_MENU.x=1.8 in defaults.lua, but some people may increase that).For info, some months ago (so it may no more be correct), I checked the various gestures overrides and possible conflicts in #4856 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agree :)