mirror of
https://github.com/Kunsi/scheduled-plugin-pretalx-broadcast-tools.git
synced 2024-11-22 01:51:03 +00:00
add alignment options for room name
This commit is contained in:
parent
747b0eaae2
commit
3957edc631
2 changed files with 28 additions and 9 deletions
12
tile.js
12
tile.js
|
@ -57,6 +57,17 @@ var config = {
|
|||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if='mode == "room"'>
|
||||
<h4>room options</h4>
|
||||
<div class='row'>
|
||||
<div class='col-xs-3'>
|
||||
<select class='btn btn-default' v-model="room_align">
|
||||
<option value="left">Align left</option>
|
||||
<option value="center">Align centered</option>
|
||||
<option value="right">Align right</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if='mode == "day"'>
|
||||
<h4>Clock options</h4>
|
||||
<div class='row'>
|
||||
|
@ -84,6 +95,7 @@ var config = {
|
|||
font_size: ChildTile.config_value('font_size', 70, parseInt),
|
||||
all_speakers: ChildTile.config_value('all_speakers', true),
|
||||
next_abstract: ChildTile.config_value('next_abstract', false),
|
||||
room_align: ChildTile.config_value('room_align', 'left'),
|
||||
day_align: ChildTile.config_value('day_align', 'left'),
|
||||
day_template: ChildTile.config_value('day_template', 'Day %d'),
|
||||
}
|
||||
|
|
25
tile.lua
25
tile.lua
|
@ -309,11 +309,18 @@ end
|
|||
|
||||
local function view_room(starts, ends, config, x1, y1, x2, y2)
|
||||
local font_size = config.font_size or 70
|
||||
local align = config.room_align or "left"
|
||||
local r,g,b = helper.parse_rgb(config.color or "#ffffff")
|
||||
|
||||
for now in api.frame_between(starts, ends) do
|
||||
local line = current_room
|
||||
font:write(x1, y1, line, font_size, r,g,b)
|
||||
local x = x1
|
||||
local w = font:width(current_room, font_size)
|
||||
if align == "right" then
|
||||
x = x2 - w
|
||||
elseif align == "center" then
|
||||
x = (x1 + x2 - w) / 2
|
||||
end
|
||||
font:write(x, y1, current_room, font_size, r,g,b)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -324,16 +331,16 @@ local function view_day(starts, ends, config, x1, y1, x2, y2)
|
|||
local template = config.day_template or "Day %d"
|
||||
|
||||
for now in api.frame_between(starts, ends) do
|
||||
local x = x1
|
||||
local line = string.format(template, day)
|
||||
if align == "left" then
|
||||
font:write(x1, y1, line, font_size, r,g,b)
|
||||
local w = font:width(line, font_size)
|
||||
|
||||
if align == "right" then
|
||||
x = x2 - w
|
||||
elseif align == "center" then
|
||||
local w = font:width(line, font_size)
|
||||
font:write((x1+x2-w) / 2, y1, line, font_size, r,g,b)
|
||||
else
|
||||
local w = font:width(line, font_size)
|
||||
font:write(x2-w, y1, line, font_size, r,g,b)
|
||||
x = (x1 + x2 - w) / 2
|
||||
end
|
||||
font:write(x1, y1, line, font_size, r,g,b)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue