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
|
invert_vertical = false, -- true flips the swipe direction
|
||||||
left_zone_ratio = 0.35, -- fraction of width reserved for brightness (left side)
|
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)
|
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
|
osd_duration = 1.2, -- seconds OSD stays visible; set 0 to disable
|
||||||
log_debug = false, -- set true to log gesture details
|
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)
|
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
|
return w, h
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pick_zone(x, width)
|
local function pick_zone(x, y, width, height)
|
||||||
if width <= 0 then
|
if width <= 0 then
|
||||||
return nil
|
return nil
|
||||||
end
|
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 left_limit = width * config.left_zone_ratio
|
||||||
local right_start = width * (1 - config.right_zone_ratio)
|
local right_start = width * (1 - config.right_zone_ratio)
|
||||||
if x <= left_limit then
|
if x <= left_limit then
|
||||||
@@ -282,8 +289,8 @@ local function update_gesture(_, pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not state.active and config.start_on_move then
|
if not state.active and config.start_on_move then
|
||||||
local width = surface_size()
|
local width, height = surface_size()
|
||||||
local zone = pick_zone(pos.x, width)
|
local zone = pick_zone(pos.x, pos.y, width, height)
|
||||||
if zone then
|
if zone then
|
||||||
start_gesture(pos, zone)
|
start_gesture(pos, zone)
|
||||||
else
|
else
|
||||||
@@ -354,8 +361,8 @@ local function handle_touch(event)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local width = surface_size()
|
local width, height = surface_size()
|
||||||
local zone = pick_zone(pos.x, width)
|
local zone = pick_zone(pos.x, pos.y, width, height)
|
||||||
if not zone then
|
if not zone then
|
||||||
forwarding_click = true
|
forwarding_click = true
|
||||||
mp.commandv("keypress", "mouse_btn0")
|
mp.commandv("keypress", "mouse_btn0")
|
||||||
|
|||||||
Reference in New Issue
Block a user