mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Double tap: Update default tap zones (#7711)
Make 'em match backward & forward. Now that we have working overrides and the gesture manager, trying to fit them in a weird superset of the top corner tapzones in a vain attempt to avoid bad interactions doesn't make much sense anymore, and just makes the Gesture Manager UI confusing. Also make sure the corner zones override the L/R ones for double taps, like it's the case with other gestures. Fix #7710
This commit is contained in:
@@ -88,8 +88,8 @@ DTAP_ZONE_TOP_LEFT = {x = 0, y = 0, w = 1/8, h = 1/8}
|
||||
DTAP_ZONE_TOP_RIGHT = {x = 7/8, y = 0, w = 1/8, h = 1/8}
|
||||
DTAP_ZONE_BOTTOM_LEFT = {x = 0, y = 7/8, w = 1/8, h = 1/8}
|
||||
DTAP_ZONE_BOTTOM_RIGHT = {x = 7/8, y = 7/8, w = 1/8, h = 1/8}
|
||||
DDOUBLE_TAP_ZONE_NEXT_CHAPTER = {x = 6/8, y = 0, w = 2/8, h = 2/8}
|
||||
DDOUBLE_TAP_ZONE_PREV_CHAPTER = {x = 0, y = 0, w = 2/8, h = 2/8}
|
||||
DDOUBLE_TAP_ZONE_NEXT_CHAPTER = {x = 1/4, y = 0, w = 3/4, h = 1}
|
||||
DDOUBLE_TAP_ZONE_PREV_CHAPTER = {x = 0, y = 0, w = 1/4, h = 1}
|
||||
|
||||
-- behaviour of swipes
|
||||
DCHANGE_WEST_SWIPE_TO_EAST = false
|
||||
|
||||
@@ -771,6 +771,7 @@ function Gestures:setupGesture(ges)
|
||||
ratio_w = DTAP_ZONE_BOTTOM_RIGHT.w,
|
||||
ratio_h = DTAP_ZONE_BOTTOM_RIGHT.h,
|
||||
}
|
||||
-- NOTE: The defaults are effectively mapped to DTAP_ZONE_BACKWARD & DTAP_ZONE_FORWARD
|
||||
local zone_left = {
|
||||
ratio_x = DDOUBLE_TAP_ZONE_PREV_CHAPTER.x,
|
||||
ratio_y = DDOUBLE_TAP_ZONE_PREV_CHAPTER.y,
|
||||
@@ -785,6 +786,7 @@ function Gestures:setupGesture(ges)
|
||||
}
|
||||
|
||||
local overrides_tap_corner
|
||||
local overrides_double_tap_corner
|
||||
local overrides_hold_corner
|
||||
local overrides_vertical_edge, overrides_horizontal_edge
|
||||
local overrides_pan, overrides_pan_release
|
||||
@@ -808,6 +810,10 @@ function Gestures:setupGesture(ges)
|
||||
"tap_forward",
|
||||
"tap_backward",
|
||||
}
|
||||
overrides_double_tap_corner = {
|
||||
"double_tap_left_side",
|
||||
"double_tap_right_side",
|
||||
}
|
||||
overrides_hold_corner = {
|
||||
-- As hold corners are "ignored" by default, and we have
|
||||
-- a "Ignore hold on corners" menu item and gesture, let
|
||||
@@ -875,15 +881,19 @@ function Gestures:setupGesture(ges)
|
||||
elseif ges == "double_tap_top_left_corner" then
|
||||
ges_type = "double_tap"
|
||||
zone = zone_top_left_corner
|
||||
overrides = overrides_double_tap_corner
|
||||
elseif ges == "double_tap_top_right_corner" then
|
||||
ges_type = "double_tap"
|
||||
zone = zone_top_right_corner
|
||||
overrides = overrides_double_tap_corner
|
||||
elseif ges == "double_tap_bottom_right_corner" then
|
||||
ges_type = "double_tap"
|
||||
zone = zone_bottom_right_corner
|
||||
overrides = overrides_double_tap_corner
|
||||
elseif ges == "double_tap_bottom_left_corner" then
|
||||
ges_type = "double_tap"
|
||||
zone = zone_bottom_left_corner
|
||||
overrides = overrides_double_tap_corner
|
||||
elseif ges == "hold_top_left_corner" then
|
||||
ges_type = "hold"
|
||||
zone = zone_top_left_corner
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("defaults module", function()
|
||||
assert.is_same(DCREREADER_CONFIG_WORD_SPACING_LARGE, { [1] = 100, [2] = 90 })
|
||||
assert.is_same(DTAP_ZONE_BACKWARD, { ["y"] = 0, ["x"] = 0, ["h"] = 1, ["w"] = 0.25 })
|
||||
assert.is_same(DCREREADER_CONFIG_H_MARGIN_SIZES_XXX_LARGE, { [1] = 50, [2] = 50 })
|
||||
assert.is_same(DDOUBLE_TAP_ZONE_PREV_CHAPTER, { ["y"] = 0, ["x"] = 0, ["h"] = 0.25, ["w"] = 0.25 })
|
||||
assert.is_same(DDOUBLE_TAP_ZONE_PREV_CHAPTER, { ["y"] = 0, ["x"] = 0, ["h"] = 1, ["w"] = 0.25 })
|
||||
|
||||
-- in persistent
|
||||
Defaults:init()
|
||||
|
||||
Reference in New Issue
Block a user