fix: ignore bottom edge so gestures avoid osc
This commit is contained in:
@@ -21,6 +21,7 @@ local config = {
|
||||
invert_vertical = false, -- true flips the swipe direction
|
||||
left_zone_ratio = 0.35, -- fraction of width reserved for brightness (left side)
|
||||
right_zone_ratio = 0.35, -- fraction of width reserved for volume (right side)
|
||||
bottom_exclude_ratio = 0.15, -- ignore bottom portion (e.g., OSC area); 0 disables
|
||||
osd_duration = 1.2, -- seconds OSD stays visible; set 0 to disable
|
||||
log_debug = false, -- set true to log gesture details
|
||||
start_on_move = true, -- begin a gesture on move in edge zones (helps touch devices without BTN events)
|
||||
@@ -214,10 +215,16 @@ local function surface_size()
|
||||
return w, h
|
||||
end
|
||||
|
||||
local function pick_zone(x, width)
|
||||
local function pick_zone(x, y, width, height)
|
||||
if width <= 0 then
|
||||
return nil
|
||||
end
|
||||
if height and height > 0 and config.bottom_exclude_ratio > 0 then
|
||||
local cutoff = height * (1 - config.bottom_exclude_ratio)
|
||||
if y >= cutoff then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local left_limit = width * config.left_zone_ratio
|
||||
local right_start = width * (1 - config.right_zone_ratio)
|
||||
if x <= left_limit then
|
||||
@@ -282,8 +289,8 @@ local function update_gesture(_, pos)
|
||||
end
|
||||
|
||||
if not state.active and config.start_on_move then
|
||||
local width = surface_size()
|
||||
local zone = pick_zone(pos.x, width)
|
||||
local width, height = surface_size()
|
||||
local zone = pick_zone(pos.x, pos.y, width, height)
|
||||
if zone then
|
||||
start_gesture(pos, zone)
|
||||
else
|
||||
@@ -354,8 +361,8 @@ local function handle_touch(event)
|
||||
return
|
||||
end
|
||||
|
||||
local width = surface_size()
|
||||
local zone = pick_zone(pos.x, width)
|
||||
local width, height = surface_size()
|
||||
local zone = pick_zone(pos.x, pos.y, width, height)
|
||||
if not zone then
|
||||
forwarding_click = true
|
||||
mp.commandv("keypress", "mouse_btn0")
|
||||
|
||||
Reference in New Issue
Block a user