next talk: add option to switch between track bar and track name

This commit is contained in:
Franzi 2023-09-30 10:07:18 +02:00
parent 00c25529de
commit 738e1d0300
2 changed files with 28 additions and 9 deletions

10
tile.js
View file

@ -14,7 +14,7 @@ var config = {
</select>
</div>
<div class='col-xs-3'>
Text Color<br/>
Text Colour<br/>
<input
type="color"
v-model="color"
@ -50,6 +50,13 @@ var config = {
class='form-check-input'/>
Show abstract
</div>
<div class='col-xs-3'>
<input
type="checkbox"
v-model="next_track_text"
class='form-check-input'/>
Show track name instead of coloured bar
</div>
</div>
</template>
<template v-if='mode == "room"'>
@ -94,6 +101,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),
next_track_text: ChildTile.config_value('next_track_text', 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'),

View file

@ -121,6 +121,7 @@ end
local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
local font_size = config.font_size or 70
local show_abstract = config.next_abstract
local track_text = config.next_track_text
local default_color = {helper.parse_rgb(config.color or "#ffffff")}
local a = anims.Area(x2 - x1, y2 - y1)
@ -138,11 +139,12 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
local title_size = font_size
local abstract_size = math.floor(font_size * 0.8)
local speaker_size = math.floor(font_size * 0.8)
local track_size = math.floor(font_size * 0.6)
local current_talk = room_next_talks[1]
local col1 = 0
local col2 = 0 + font:width("in XXX min", time_size)
local col2 = 35 + font:width("in XXX min", time_size)
if #schedule == 0 then
text(col2, y, "Fetching talks...", time_size, rgba(default_color,1))
@ -174,12 +176,6 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
text(col2, y, lines[idx], title_size, rgba(default_color,1))
y = y + title_size
end
if current_talk.track then
local r,g,b = helper.parse_rgb(current_talk.track.color)
text(col2, y, current_talk.track.name, title_size, r,g,b,1)
y = y + title_size
end
y = y + 20
-- Show abstract only if it fits into the drawing area completely
@ -199,6 +195,21 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
y = y + speaker_size
end
end
if current_talk.track then
local r,g,b = helper.parse_rgb(current_talk.track.color)
if track_text then
if a.height > y + 20 + track_size then
text(col2, y+20, current_talk.track.name, track_size, r,g,b,1)
end
else
a.add(anims.moving_image_raw(
S, E, resource.create_colored_texture(r,g,b,1),
col2 - 25, 0,
col2 - 10, y
))
end
end
end
for now in api.frame_between(starts, ends) do
@ -221,7 +232,7 @@ local function view_all_talks(starts, ends, config, x1, y1, x2, y2)
-- always leave room for 15px of track bar
local col1 = 0
local col2 = 25 + font:width("XXX min ago", time_size)
local col2 = 35 + font:width("XXX min ago", time_size)
local x, y = 0, 0