diff options
author | Wuzzy <almikes@aol.com> | 2016-11-29 19:15:58 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-11-29 19:15:58 +0100 |
commit | aafa9e7784078af379068cd20e77ec8f1992c282 (patch) | |
tree | 09b9592f11fb6c839d294ac29e60cbfe91409514 /init.lua | |
parent | c7eba913044fc2db021e87b433e01faa95165f60 (diff) |
doc.entry_builders.text_and_gallery
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -479,6 +479,26 @@ doc.entry_builders.text = function(data) return formstring 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 = {} local text_id = 1 |