stats.lua: handle osd-scale-by-window runtime update

Allows the scale mode to be changed at runtime if vidscale is set to auto.
This commit is contained in:
nanahi 2024-05-16 12:30:52 -04:00 committed by Kacper Michajłow
parent 85b3a6e567
commit de371a579f
1 changed files with 12 additions and 2 deletions

View File

@ -1353,7 +1353,7 @@ local function print_page(page, after_scroll)
end
end
local function update_scale(_, value)
local function update_scale(value)
local scale_with_video
if o.vidscale == "auto" then
scale_with_video = mp.get_property_native("osd-scale-by-window")
@ -1376,6 +1376,15 @@ local function update_scale(_, value)
end
end
local function handle_osd_height_update(_, value)
update_scale(value)
end
local function handle_osd_scale_by_window_update()
local value = mp.get_property_native("osd-height")
update_scale(value)
end
local function clear_screen()
if o.persistent_overlay then mp.set_osd_ass(0, 0, "") else mp.osd_message("", 0) end
end
@ -1604,4 +1613,5 @@ if o.bindlist ~= "no" then
end)
end
mp.observe_property('osd-height', 'native', update_scale)
mp.observe_property('osd-height', 'native', handle_osd_height_update)
mp.observe_property('osd-scale-by-window', 'native', handle_osd_scale_by_window_update)