Hide gallery buttons at start or end of gallery

This commit is contained in:
Wuzzy 2016-12-02 17:29:02 +01:00
parent b4a680447c
commit e79efcb370

View File

@ -556,6 +556,7 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width,
totalimagewidth = width - bw*2 totalimagewidth = width - bw*2
iw = totalimagewidth / rows iw = totalimagewidth / rows
ih = iw * aspect_ratio ih = iw * aspect_ratio
if imageindex > 1 then
formstring = formstring .. "button["..x..","..y..";"..bw..","..ih..";doc_button_gallery_prev;"..F("<").."]" formstring = formstring .. "button["..x..","..y..";"..bw..","..ih..";doc_button_gallery_prev;"..F("<").."]"
local tt local tt
if rows == 1 then if rows == 1 then
@ -564,6 +565,8 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width,
tt = F("Show previous gallery page") tt = F("Show previous gallery page")
end end
formstring = formstring .. "tooltip[doc_button_gallery_prev;"..tt.."]" formstring = formstring .. "tooltip[doc_button_gallery_prev;"..tt.."]"
end
if (imageindex + rows) <= #imagedata then
local rightx = buttonoffset + (x + rows * iw) local rightx = buttonoffset + (x + rows * iw)
formstring = formstring .. "button["..rightx..","..y..";"..bw..","..ih..";doc_button_gallery_next;"..F(">").."]" formstring = formstring .. "button["..rightx..","..y..";"..bw..","..ih..";doc_button_gallery_next;"..F(">").."]"
if rows == 1 then if rows == 1 then
@ -572,6 +575,7 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width,
tt = F("Show next gallery page") tt = F("Show next gallery page")
end end
formstring = formstring .. "tooltip[doc_button_gallery_next;"..tt.."]" formstring = formstring .. "tooltip[doc_button_gallery_next;"..tt.."]"
end
buttonoffset = bw buttonoffset = bw
else else
totalimagewidth = width totalimagewidth = width