shuffle stuff, crop length in ballot window

This commit is contained in:
whosit 2025-03-12 21:18:06 +03:00
parent c2c722e3e3
commit d72ec4a2d5

View File

@ -268,8 +268,8 @@ function show_vote_ballot(username)
{command = "addtextarea", name='', default = categories[2], X = 12.2, Y = 0.4, W = 1.6, H = 1.0},
{command = "addtextarea", name='', default = categories[3], X = 13.9, Y = 0.4, W = 1.6, H = 1.0},
{command = "addtextarea", name='', default = categories[4], X = 15.7, Y = 0.4, W = 1.6, H = 1.0},
{command = "addlabel", label = "Your choices are saved automatically!", X = 6.8, Y = 12.5},
{command = "addbutton", name = "vote_done", label = "Done", X = 14.0, Y = 12, W = 3, H = 1},
{command = "addlabel", label = "Your choices are saved automatically!", X = 11.5, Y = 12.1},
{command = "addbutton", name = "vote_done", label = "Done", X = 14.0, Y = 12.5, W = 3, H = 1},
}
local shift = 1.3 -- vertical spacing between entries
local votes = mem.votes[username] or {}
@ -288,7 +288,9 @@ function show_vote_ballot(username)
local default_id = min_cat_score == 0 and 0 or 1
local e_v = votes[id] or {} -- previous votes of this player for this entry (if any)
table.insert(c, {command = "addimage", texture_name = "halo.png^[colorize:#222233", X = 0.5, Y = 0.4 + shift*i, W = 16.8, H = 1})
table.insert(c, {command = "addlabel", label = e.title, X = 0.8, Y = 0.9 + shift*i})
table.insert(c, {command = "addlabel",
label = string.sub(string.format("[%s] - %s", e.user, e.title), 1, 75),
X = 0.8, Y = 0.9 + shift*i})
table.insert(c, {command = "adddropdown", name = string.format("v_%d_1", id), index_event = true,
selected_id = e_v[1] and (e_v[1] - min_cat_score + 1) or default_id,
choices = choices, X = 10.8, Y = 0.5 + shift*i, W = 0.8, H = 0.8})