Raise Load navigation symbols and enlarge labels
Beffroi/beffroi-tools/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-11-12 19:36:23 +01:00
parent 269b58b383
commit bb045ec527
4 changed files with 139 additions and 15 deletions

View File

@ -248,6 +248,9 @@ two-second result display. **Last load result** retains the outcome as **#1**, *
on failures/in-progress; successful results show the video name.
`load_result_direction` contains `item_1`, `item_2`, etc.
Load next / previous use separate symbol and label layers, with the symbol raised
to leave room for larger text. Re-add existing copied presets to get the new layout.
Numbered Load presets use Companion 5 layered graphics: a small **↓ LOAD** title
above a large item number. Re-add existing copied presets to get this layout;
linked presets update automatically.

View File

@ -107,21 +107,97 @@ export function presets(label = 'MPC_DEV') {
steps: [{ down: [], up: [] }],
feedbacks: [{ feedbackId: 'load_result', options: {} }],
},
transport_load_next: button(
'Load next',
'↦\nLOAD\nNEXT',
'load_next',
[{ feedbackId: 'load_next_status', options: {} }],
12,
0x243b50,
),
transport_load_previous: button(
'Load previous',
'↤\nLOAD\nPREV',
'load_previous',
[{ feedbackId: 'load_previous_status', options: {} }],
12,
0x243b50,
...Object.fromEntries(
['next', 'previous'].map((direction) => [
`transport_load_${direction}`,
{
type: 'layered',
name: `Load ${direction}`,
canvas: { decoration: 'topbar' },
elements: [
{ id: 'background', type: 'box', x: 0, y: 0, width: 100, height: 100, color: 0x243b50 },
{
id: 'icon',
type: 'text',
text: direction === 'next' ? '↦' : '↤',
x: 5,
y: -4,
width: 90,
height: 30,
fontsize: 100,
fontsizeAllowShrink: true,
color: colors.white,
halign: 'center',
valign: 'center',
},
{
id: 'title',
type: 'text',
text: 'LOAD',
x: 3,
y: 27,
width: 94,
height: 33,
fontsize: 100,
fontsizeAllowShrink: true,
color: colors.white,
halign: 'center',
valign: 'center',
},
{
id: 'direction',
type: 'text',
text: direction === 'next' ? 'NEXT' : 'PREV',
x: 3,
y: 62,
width: 94,
height: 35,
fontsize: 100,
fontsizeAllowShrink: true,
color: colors.white,
halign: 'center',
valign: 'center',
},
],
steps: [{ down: [{ actionId: `load_${direction}`, options: { target: 'both' } }], up: [] }],
feedbacks: [
...['loading', 'ready', 'failed'].map((state) => ({
feedbackId: 'load_direction_state',
options: { direction, state },
styleOverrides: [
{
elementId: 'title',
elementProperty: 'text',
override: { loading: 'LOADING', ready: 'LOADED', failed: 'FAILED' }[state],
},
{
elementId: 'background',
elementProperty: 'color',
override: { loading: colors.amber, ready: colors.blue, failed: colors.red }[state],
},
...['icon', 'title', 'direction'].map((elementId) => ({
elementId,
elementProperty: 'color',
override: state === 'loading' ? colors.dark : colors.white,
})),
],
})),
{
feedbackId: 'offline',
options: {},
styleOverrides: [
{ elementId: 'title', elementProperty: 'text', override: 'OFFLINE' },
{ elementId: 'background', elementProperty: 'color', override: colors.dark },
...['icon', 'title', 'direction'].map((elementId) => ({
elementId,
elementProperty: 'color',
override: 0x889099,
})),
],
},
],
},
]),
),
transport_play: button(
'Play — green while playing',

View File

@ -121,6 +121,28 @@ export function feedbacks(getState, getSync = () => null, getLoadStatus = () =>
},
]),
),
load_direction_state: {
type: 'boolean',
name: 'Load next / previous state',
options: [
{
type: 'dropdown',
id: 'direction',
label: 'Direction',
default: 'next',
choices: ['next', 'previous'].map((id) => ({ id, label: id })),
},
{
type: 'dropdown',
id: 'state',
label: 'State',
default: 'loading',
choices: ['loading', 'ready', 'failed'].map((id) => ({ id, label: id })),
},
],
defaultStyle: { bgcolor: colors.blue },
callback: (feedback) => getLoadStatus(feedback.options.direction) === feedback.options.state,
},
load_playlist_item_state: {
type: 'boolean',
name: 'Load playlist item state',

View File

@ -161,3 +161,26 @@ test('loaded filename preview uses the basename, wraps and truncates without spl
)
assert.equal(fb.load_result.callback().text, 'LOADED\nIntro')
})
test('layered directional load feedback follows each direction and clears after its result expires', () => {
let current = 'loading'
const definitions = feedbacks(
() => null,
() => null,
(direction) => (direction === 'next' ? current : 'idle'),
)
const catalog = presets()
for (const state of ['loading', 'ready', 'failed', 'idle']) {
current = state
for (const direction of ['next', 'previous']) {
const preset = catalog[`transport_load_${direction}`]
assert.equal(preset.type, 'layered')
for (const feedback of preset.feedbacks.filter((item) => item.feedbackId === 'load_direction_state')) {
assert.equal(
definitions.load_direction_state.callback(feedback),
direction === 'next' && feedback.options.state === state,
)
}
}
}
})