From eedda59a6941f1b9d1968ccf75d5578718b0b08c Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Mon, 31 Oct 2016 16:46:35 +0000 Subject: osc: add alpha animation to tooltip Fixes lingering tooltip with full alpha if mouse leaves window with OSC still active. --- player/lua/osc.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 4e97d75baf..14c18767d8 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -71,7 +71,7 @@ local osc_styles = { topButtonsBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs18\\fnmpv-osd-symbols}", smallButtonsBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs28\\fnmpv-osd-symbols}", timecodesBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs27}", - timePosBar = "{\\blur0\\bord".. user_opts.tooltipborder .."\\1c&HFFFFFF\\3c&H000000\\1a&H00\\3a&H88\\fs30}", + timePosBar = "{\\blur0\\bord".. user_opts.tooltipborder .."\\1c&HFFFFFF\\3c&H000000\\fs30}", vidtitleBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs18\\q2}", } @@ -625,6 +625,18 @@ function render_elements(master_ass) elem_ass:pos(tx, ty) elem_ass:an(an) elem_ass:append(slider_lo.tooltip_style) + + --alpha + local ar = slider_lo.alpha + if not (state.animation == nil) then + ar = {} + for ai, av in pairs(slider_lo.alpha) do + ar[ai] = mult_alpha(av, state.animation) + end + end + elem_ass:append(string.format("{\\1a&H%X&\\2a&H%X&\\3a&H%X&\\4a&H%X&}", + ar[1], ar[2], ar[3], ar[4])) + elem_ass:append(tooltiplabel) end @@ -832,6 +844,7 @@ function add_layout(name) adjust_tooltip = true, tooltip_style = "", tooltip_an = 2, + alpha = {[1] = 0, [2] = 255, [3] = 88, [4] = 255}, } elseif (elements[name].type == "box") then elements[name].layout.box = {radius = 0} -- cgit v1.2.3