diff options
author | Ricardo Constantino <wiiaboo@gmail.com> | 2016-10-05 16:47:24 +0100 |
---|---|---|
committer | Ricardo Constantino <wiiaboo@gmail.com> | 2016-10-07 00:31:49 +0100 |
commit | 65c75112a7f0c9c6ad886fc39f97099033733f55 (patch) | |
tree | b835d579357338698c22b6ea94c4f4aa51ee48c6 /player/lua/osc.lua | |
parent | e41dbc30198a615f5794486db91567410ce6a2f0 (diff) | |
download | mpv-65c75112a7f0c9c6ad886fc39f97099033733f55.tar.bz2 mpv-65c75112a7f0c9c6ad886fc39f97099033733f55.tar.xz |
osc: move tooltip to inside seekbar for top/bottombar
Tooltip border is user-alterable
Diffstat (limited to 'player/lua/osc.lua')
-rw-r--r-- | player/lua/osc.lua | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua index c8cfa5274c..07d6f03984 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -31,6 +31,7 @@ local user_opts = { -- functions that depend on it) layout = "box", seekbarstyle = "slider", -- slider (diamond marker) or bar (fill) + tooltipborder = 1, -- border of tooltip in bottom/topbar timetotal = false, -- display total time instead of remaining time? timems = false, -- display timecodes with milliseconds? visibility = "auto", -- only used at init to set visibility_mode(...) @@ -63,6 +64,7 @@ local osc_styles = { elementDown = "{\\1c&H999999}", timecodes = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs20}", vidtitle = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs12}", + timePos = "{\\blur0\\bord".. user_opts.tooltipborder .."\\1c&HFFFFFF\\3c&H000000\\1a&H00\\3a&H88\\fs20}", box = "{\\rDefault\\blur0\\bord1\\1c&H000000\\3c&HFFFFFF}", } @@ -585,32 +587,34 @@ function render_elements(master_ass) local an = slider_lo.tooltip_an - if (slider_lo.adjust_tooltip) then - if (sliderpos < (s_min + 5)) then - if an == 2 then - an = 1 - else - an = 7 - end - elseif (sliderpos > (s_max - 5)) then - if an == 2 then - an = 3 - else - an = 9 - end - end - end - - local ty - if (slider_lo.tooltip_an == 2) then + + if (an == 2) then ty = element.hitbox.y1 - slider_lo.border else - ty = element.hitbox.y2 + slider_lo.border + ty = element.hitbox.y1 + elem_geo.h/2 end + local tx = get_virt_mouse_pos() + if (slider_lo.adjust_tooltip) then + if (an == 2) then + if (sliderpos < (s_min + 3)) then + an = an - 1 + elseif (sliderpos > (s_max - 3)) then + an = an + 1 + end + elseif (sliderpos > (s_max-s_min)/2) then + an = an + 1 + tx = tx - 5 + else + an = an - 1 + tx = tx + 10 + end + end + + -- tooltip label elem_ass:new_event() - elem_ass:pos(get_virt_mouse_pos(), ty) + elem_ass:pos(tx, ty) elem_ass:an(an) elem_ass:append(slider_lo.tooltip_style) elem_ass:append(tooltiplabel) @@ -1164,9 +1168,9 @@ layouts["bottombar"] = function() lo = add_layout("seekbar") lo.geometry = geo lo.style = osc_styles.timecodes - lo.layer = 16 lo.slider.border = 0 - lo.slider.tooltip_style = osc_styles.vidtitle + lo.slider.tooltip_style = osc_styles.timePos + lo.slider.tooltip_an = 5 lo.slider.stype = user_opts["seekbarstyle"] end @@ -1273,11 +1277,10 @@ layouts["topbar"] = function() lo = add_layout("seekbar") lo.geometry = geo lo.style = osc_styles.timecodes - lo.layer = 16 lo.slider.border = 0 - lo.slider.tooltip_style = osc_styles.vidtitle + lo.slider.tooltip_style = osc_styles.timePos lo.slider.stype = user_opts["seekbarstyle"] - lo.slider.tooltip_an = 8 + lo.slider.tooltip_an = 5 -- Playlist prev/next |