Skip to content

Commit 12b6ad1

Browse files
authored
Merge pull request #143 from Samillion/dev_buttons_visibility_fix
fix: correctly hide buttons on window resize to not overlap
2 parents dc73862 + 8f1ddaf commit 12b6ad1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

modernz.lua

+11-11
Original file line numberDiff line numberDiff line change
@@ -1666,12 +1666,12 @@ layouts = function ()
16661666

16671667
-- Volumebar
16681668
lo = new_element("volumebarbg", "box")
1669-
lo.visible = (osc_param.playresx >= 1000 - outeroffset) and user_opts.volumecontrol
1669+
lo.visible = (osc_param.playresx >= 950 - outeroffset) and user_opts.volumecontrol
16701670
lo = add_layout("volumebarbg")
16711671
lo.geometry = {x = 200 - (showplaylist and 0 or 45), y = refY - 40, an = 4, w = 80, h = 2}
16721672
lo.layer = 13
16731673
lo.alpha[1] = 128
1674-
lo.style = user_opts.vol_bar_match_seek and osc_styles.SeekbarBg or osc_styles.volumebar_bg
1674+
lo.style = user_opts.vol_bar_match_seek and osc_styles.seekbar_bg or osc_styles.volumebar_bg
16751675

16761676
lo = add_layout("volumebar")
16771677
lo.geometry = {x = 200 - (showplaylist and 0 or 45), y = refY - 40, an = 4, w = 80, h = 8}
@@ -1948,7 +1948,7 @@ local function osc_init()
19481948
ne = new_element("sub_track", "button")
19491949
ne.enabled = sub_track_count > 0
19501950
ne.off = sub_track_count == 0 or not mp.get_property_native("sid")
1951-
ne.visible = (osc_param.playresx >= 600 - outeroffset)
1951+
ne.visible = (osc_param.playresx >= 650 - outeroffset)
19521952
ne.content = icons.subtitle
19531953
ne.tooltip_style = osc_styles.tooltip
19541954
ne.tooltipF = function ()
@@ -1967,7 +1967,7 @@ local function osc_init()
19671967
ne = new_element("tog_playlist", "button")
19681968
ne.enabled = have_pl or not user_opts.gray_empty_playlist_button
19691969
ne.off = not have_pl and user_opts.gray_empty_playlist_button
1970-
ne.visible = (osc_param.playresx >= 700 - outeroffset)
1970+
ne.visible = (osc_param.playresx >= 750 - outeroffset)
19711971
ne.content = icons.playlist
19721972
ne.tooltip_style = osc_styles.tooltip
19731973
ne.tooltipF = have_pl and texts.playlist .. " [" .. pl_pos .. "/" .. pl_count .. "]" or texts.playlist
@@ -1979,7 +1979,7 @@ local function osc_init()
19791979
ne = new_element("vol_ctrl", "button")
19801980
ne.enabled = audio_track_count > 0
19811981
ne.off = audio_track_count == 0
1982-
ne.visible = (osc_param.playresx >= 760 - outeroffset) and user_opts.volumecontrol
1982+
ne.visible = (osc_param.playresx >= 850 - outeroffset) and user_opts.volumecontrol
19831983
ne.content = function ()
19841984
local volume = mp.get_property_number("volume", 0)
19851985
if state.mute then
@@ -2007,7 +2007,7 @@ local function osc_init()
20072007

20082008
--volumebar
20092009
ne = new_element("volumebar", "slider")
2010-
ne.visible = (osc_param.playresx >= 1000 - outeroffset) and user_opts.volumecontrol
2010+
ne.visible = (osc_param.playresx >= 950 - outeroffset) and user_opts.volumecontrol
20112011
ne.enabled = audio_track_count > 0
20122012
ne.slider.markerF = function () return {} end
20132013
ne.slider.seekRangesF = function() return nil end
@@ -2050,13 +2050,13 @@ local function osc_init()
20502050
if user_opts.tooltip_hints then
20512051
ne.tooltipF = texts.statsinfo
20522052
end
2053-
ne.visible = (osc_param.playresx >= 600 - outeroffset - (user_opts.showfullscreen and 0 or 100))
2053+
ne.visible = (osc_param.playresx >= 650 - outeroffset - (user_opts.showfullscreen and 0 or 100))
20542054
ne.eventresponder["mbtn_left_up"] = function () mp.commandv("script-binding", "stats/display-stats-toggle") end
20552055

20562056
--tog_loop
20572057
ne = new_element("tog_loop", "button")
20582058
ne.content = function () return state.looping and icons.loop_on or icons.loop_off end
2059-
ne.visible = (osc_param.playresx >= 700 - outeroffset - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
2059+
ne.visible = (osc_param.playresx >= 750 - outeroffset - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
20602060
ne.tooltip_style = osc_styles.tooltip
20612061
if user_opts.tooltip_hints then
20622062
ne.tooltipF = function () return state.looping and texts.loopdisable or texts.loopenable end
@@ -2078,7 +2078,7 @@ local function osc_init()
20782078
if user_opts.tooltip_hints then
20792079
ne.tooltipF = function () return mp.get_property("ontop") == "no" and texts.ontop or texts.ontopdisable end
20802080
end
2081-
ne.visible = (osc_param.playresx >= 760 - outeroffset - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
2081+
ne.visible = (osc_param.playresx >= 850 - outeroffset - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
20822082
ne.eventresponder["mbtn_left_up"] = function ()
20832083
mp.commandv("cycle", "ontop")
20842084
if state.initialborder == "yes" then
@@ -2103,7 +2103,7 @@ local function osc_init()
21032103
if user_opts.tooltip_hints then
21042104
ne.tooltipF = texts.screenshot
21052105
end
2106-
ne.visible = (osc_param.playresx >= 870 - outeroffset - (user_opts.showontop and 0 or 100) - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
2106+
ne.visible = (osc_param.playresx >= 950 - outeroffset - (user_opts.showontop and 0 or 100) - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100))
21072107
ne.eventresponder["mbtn_left_up"] = function ()
21082108
local tempSubPosition = mp.get_property("sub-pos")
21092109
if user_opts.screenshot_flag == "subtitles" or user_opts.screenshot_flag == "subtitles+each-frame" then
@@ -2116,7 +2116,7 @@ local function osc_init()
21162116
--download
21172117
ne = new_element("download", "button")
21182118
ne.content = function () return state.downloading and icons.downloading or icons.download end
2119-
ne.visible = (osc_param.playresx >= 1000 - outeroffset - (user_opts.showscreenshot and 0 or 100) - (user_opts.showontop and 0 or 100) - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100)) and state.isWebVideo
2119+
ne.visible = (osc_param.playresx >= 1050 - outeroffset - (user_opts.showscreenshot and 0 or 100) - (user_opts.showontop and 0 or 100) - (user_opts.showloop and 0 or 100) - (user_opts.showinfo and 0 or 100) - (user_opts.showfullscreen and 0 or 100)) and state.isWebVideo
21202120
ne.tooltip_style = osc_styles.tooltip
21212121
ne.tooltipF = function () return state.downloading and "Downloading..." or state.fileSizeNormalised end
21222122
ne.eventresponder["mbtn_left_up"] = function ()

0 commit comments

Comments
 (0)