From 85bd44433951861c6ff55bcd79b0a1d9bece90e8 Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Sun, 20 Sep 2020 03:01:38 +0300 Subject: [PATCH] overlay doesn't need to be global --- videoclip.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/videoclip.lua b/videoclip.lua index af69086..445570f 100644 --- a/videoclip.lua +++ b/videoclip.lua @@ -25,7 +25,6 @@ local config = { } mpopt.read_options(config, 'videoclip') -local overlay = mp.create_osd_overlay('ass-events') local menu local encoder local OSD @@ -187,6 +186,13 @@ end menu = {} +menu.overlay = mp.create_osd_overlay('ass-events') + +menu.overlay_draw = function(text) + menu.overlay.data = text + menu.overlay:update() +end + menu.keybinds = { { key = 's', fn = function() menu.set_time('start') end }, { key = 'e', fn = function() menu.set_time('end') end }, @@ -235,14 +241,14 @@ menu.update = function() osd:tab():bold('o: '):append('Open `streamable.com`'):newline() osd:tab():bold('ESC: '):append('Close'):newline() - osd:draw() + menu.overlay_draw(osd.text) end menu.close = function() for _, val in pairs(menu.keybinds) do mp.remove_key_binding(val.key) end - overlay:remove() + menu.overlay:remove() end menu.open = function()