doc.entry_builders.text_and_gallery
This commit is contained in:
parent
c7eba91304
commit
aafa9e7784
20
init.lua
20
init.lua
@ -479,6 +479,26 @@ doc.entry_builders.text = function(data)
|
|||||||
return formstring
|
return formstring
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Scrollable freeform text with an optional standard gallery (3 rows, 3:2 aspect ratio)
|
||||||
|
doc.entry_builders.text_and_gallery = function(data, playername)
|
||||||
|
-- How much height the image gallery “steals” from the text widget
|
||||||
|
local stolen_height = 0
|
||||||
|
local formstring = ""
|
||||||
|
-- Only add the gallery if images are in the data, otherwise, the text widget gets all of the space
|
||||||
|
if data.images ~= nil then
|
||||||
|
local gallery
|
||||||
|
gallery, stolen_height = doc.widgets.gallery(data.images, playername)
|
||||||
|
formstring = formstring .. gallery
|
||||||
|
end
|
||||||
|
formstring = formstring .. doc.widgets.text(data.text,
|
||||||
|
doc.FORMSPEC.ENTRY_START_X,
|
||||||
|
doc.FORMSPEC.ENTRY_START_Y + stolen_height,
|
||||||
|
doc.FORMSPEC.ENTRY_WIDTH - 0.2,
|
||||||
|
doc.FORMSPEC.ENTRY_HEIGHT - stolen_height)
|
||||||
|
|
||||||
|
return formstring
|
||||||
|
end
|
||||||
|
|
||||||
doc.widgets = {}
|
doc.widgets = {}
|
||||||
|
|
||||||
local text_id = 1
|
local text_id = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user