Skip to content

Commit

Permalink
stats.lua: handle osd-scale-by-window runtime update
Browse files Browse the repository at this point in the history
Allows the scale mode to be changed at runtime if vidscale is set to auto.
  • Loading branch information
na-na-hi committed May 16, 2024
1 parent 3b87173 commit de27991
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions player/lua/stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 scale = mp.get_property_native("osd-height")
update_scale(scale)
end

local function clear_screen()
if o.persistent_overlay then mp.set_osd_ass(0, 0, "") else mp.osd_message("", 0) end
end
Expand Down Expand Up @@ -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)

0 comments on commit de27991

Please sign in to comment.