Commit: ca2c5362603e0a92402a46d241921d80c4c2376c
Parent: 794206e2ab382dc5c8efbb1c0c86737204d772b2
Author: Ren Tatsumoto
Date: Sun, 13 Sep 2020 09:05:32 +0300
change scope of the overlay
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -34,7 +34,6 @@ local config = {
local utils = require('mp.utils')
local msg = require('mp.msg')
local mpopt = require('mp.options')
-local overlay = mp.create_osd_overlay('ass-events')
mpopt.read_options(config, "subs2srs")
@@ -735,6 +734,13 @@ menu = {}
menu.active = false
+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() subs.set_timing('start') end },
{ key = 'e', fn = function() subs.set_timing('end') end },
@@ -778,7 +784,8 @@ menu.update = function()
osd:tab():bold('ctrl+e: '):append('Export note'):newline()
osd:tab():bold('ctrl+h: '):append('Seek to the start of the line'):newline()
osd:tab():bold('ctrl+c: '):append('Copy current subtitle to clipboard'):newline()
- osd:draw()
+
+ menu.overlay_draw(osd.text)
end
menu.open = function()
@@ -803,7 +810,7 @@ menu.close = function()
mp.remove_key_binding(val.key)
end
- overlay:remove()
+ menu.overlay:remove()
menu.active = false
end
@@ -847,11 +854,6 @@ function OSD:align(number)
return self:append('{\\an' .. number .. '}')
end
-function OSD:draw()
- overlay.data = self.text
- overlay:update()
-end
-
------------------------------------------------------------
-- main