feat(signage): slides keep their shape on any screen, custom shapes (21:9, 16:10…), Calibrate the picture edge by edge with presets
A slide is drawn at its playlist's shape, as large as fits the screen's picture, the bands in its own background (or stretched, the screen's choice). Playlists and library slides may have a shape of their own (aspect, Alembic 0045). Signage -> Screens -> Calibrate the picture: the TV outlines its area with arrows and its size, each edge moves pixel by pixel or a preset centres a shape; the TV follows live (signage.calibrate) and reports its window (POST /screen/viewport). Plan 6R.13, F-110. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,3 +243,30 @@ test('container units: an older browser gets calc() of the variables the compat
|
||||
assert.deepEqual(CQ_BOX, { 'data-cq': '' })
|
||||
} finally { delete globalThis.CSS }
|
||||
})
|
||||
|
||||
test('slide shapes: custom ratios, the canvas, the box a slide keeps on any screen (6R.13)', async () => {
|
||||
const { canvasOf, fitBox, parseAspect, pictureArea, presetInsets, shapeName, shapeOf, shapeRatio } = await import('../src/logic.js')
|
||||
assert.deepEqual(parseAspect('21:9'), [21, 9])
|
||||
assert.equal(parseAspect('9:1'), null)
|
||||
assert.equal(parseAspect('16x9'), null)
|
||||
assert.equal(shapeOf({ orientation: 'portrait' }), 'portrait')
|
||||
assert.equal(shapeOf({ orientation: 'landscape', aspect: '21:9' }), '21:9')
|
||||
assert.equal(shapeOf({ orientation: 'landscape', aspect: 'nope' }), 'landscape')
|
||||
assert.equal(shapeRatio('landscape'), 16 / 9)
|
||||
assert.deepEqual(canvasOf('landscape'), { w: 1920, h: 1080 })
|
||||
assert.deepEqual(canvasOf('portrait'), { w: 1080, h: 1920 })
|
||||
assert.deepEqual(canvasOf('21:9'), { w: 1920, h: 823 })
|
||||
// a 16:9 slide on a 21:9 monitor: full height, bands left and right
|
||||
const b = fitBox(2560, 1080, 16 / 9)
|
||||
assert.deepEqual([Math.round(b.left), b.top, Math.round(b.width), b.height], [320, 0, 1920, 1080])
|
||||
// on 16:10: full width, bands above and below
|
||||
const c = fitBox(1920, 1200, 16 / 9)
|
||||
assert.deepEqual([c.left, c.top, c.width, c.height], [0, 60, 1920, 1080])
|
||||
// calibration: the window minus the insets; the presets centre a shape
|
||||
assert.deepEqual(pictureArea({ w: 1920, h: 1080 }, { left: 10, top: 0, right: 30, bottom: 20 }), { left: 10, top: 0, width: 1880, height: 1060 })
|
||||
assert.deepEqual(presetInsets({ w: 2560, h: 1080 }, '16:9'), { left: 320, top: 0, right: 320, bottom: 0 })
|
||||
assert.deepEqual(presetInsets({ w: 1920, h: 1080 }, 'full'), { left: 0, top: 0, right: 0, bottom: 0 })
|
||||
assert.equal(shapeName(2560, 1080), '21:9')
|
||||
assert.equal(shapeName(1920, 1200), '16:10')
|
||||
assert.equal(shapeName(1000, 300), '10:3')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user