mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[fix] GestureDetector: add PAN_DELAYED_INTERVAL (#4666)
When multiswipes are enabled, this fixes the long-standing complaint that swiping to open the menu could unintentionally trigger some light panning. With the introduction of multiswipes, this problem has become more noticeable.
This commit is contained in:
@@ -401,8 +401,12 @@ function ReaderPaging:onPan(_, ges)
|
||||
self.view:PanningStart(-ges.relative.x, -ges.relative.y)
|
||||
end
|
||||
elseif ges.direction == "north" or ges.direction == "south" then
|
||||
self:onPanningRel(self.last_pan_relative_y - ges.relative.y)
|
||||
self.last_pan_relative_y = ges.relative.y
|
||||
local relative_type = "relative"
|
||||
if self.ui.gesture and self.ui.gesture.multiswipes_enabled then
|
||||
relative_type = "relative_delayed"
|
||||
end
|
||||
self:onPanningRel(self.last_pan_relative_y - ges[relative_type].y)
|
||||
self.last_pan_relative_y = ges[relative_type].y
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -421,10 +421,14 @@ end
|
||||
|
||||
function ReaderRolling:onPan(_, ges)
|
||||
if self.view.view_mode == "scroll" then
|
||||
local distance_type = "distance"
|
||||
if self.ui.gesture and self.ui.gesture.multiswipes_enabled then
|
||||
distance_type = "distance_delayed"
|
||||
end
|
||||
if ges.direction == "north" then
|
||||
self:_gotoPos(self.current_pos + ges.distance)
|
||||
self:_gotoPos(self.current_pos + ges[distance_type])
|
||||
elseif ges.direction == "south" then
|
||||
self:_gotoPos(self.current_pos - ges.distance)
|
||||
self:_gotoPos(self.current_pos - ges[distance_type])
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user