mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
Most of the builtin apps had some padding between the window edge and their content, because they expect to be displayed with a line border on their edge. We added a customization option to remove the border, so, that padding is not always necessary. Make the layouts dynamically adjust, to omit the padding when it isn't needed.
18 lines
1019 B
JavaScript
18 lines
1019 B
JavaScript
// Viewports for layout tests: what ctx.stack.getBaseSize() (or a worker's
|
|
// open-window message) hands a layout. Needs `tsc -p tests/tsconfig.json`.
|
|
const viewport = require('../../.test-build/app/ui/viewport.js');
|
|
|
|
/** A window with a border line along every edge (a framed window): 8px of padding all round. */
|
|
const bordered = (width, height) => viewport.viewportWith({ width, height }, viewport.uniformEdges('border'));
|
|
|
|
/** A window nothing borders (Border: None, or immersive): no padding. */
|
|
const unbordered = (width, height) => viewport.viewportWith({ width, height }, viewport.uniformEdges('offscreen'));
|
|
|
|
/** A window with border lines along just the named edges, e.g. edged(576, 260, 'top', 'left'). */
|
|
const edged = (width, height, ...borders) => viewport.viewportWith({ width, height }, {
|
|
top: 'offscreen', right: 'offscreen', bottom: 'offscreen', left: 'offscreen',
|
|
...Object.fromEntries(borders.map((edge) => [edge, 'border'])),
|
|
});
|
|
|
|
module.exports = { ...viewport, bordered, unbordered, edged };
|