Companion Buttons 1.1.0: pages in the + picker, buttons chosen on the tile
The picker row (page list, Clear, Done) is gone. Each Companion page is now its own + entry, titled with the page's name, showing the whole page minus page up/down. The grid icon switches the tile to choosing: click buttons to take them out or put them back, click the icon again when done. The gear holds one switch, Page layout (Companion's rows and columns, or packed). - Tiles follow their page by Companion's page id and buttons by row/column, so inserted pages and re-imported pages keep showing. - A tile remounted after a settings change asks GET /state for the snapshot the already-open stream sent, instead of waiting blank. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-9
@@ -8,8 +8,9 @@
|
||||
*
|
||||
* pages.watch → every page, its name, and which control
|
||||
* sits at each row/column
|
||||
* preview.graphics.controlId → a button's rendered image, following the
|
||||
* button if it is moved to another page
|
||||
* preview.graphics.controlId → a button's rendered image, on every redraw
|
||||
* controls.watchControl → a button's setup, read once for its kind
|
||||
* (page up/down buttons are left out)
|
||||
*
|
||||
* Nothing here can press, edit or change anything in Companion.
|
||||
*
|
||||
@@ -245,7 +246,7 @@ function createPageBook() {
|
||||
}
|
||||
}
|
||||
buttons.sort((a, b) => a.row - b.row || a.column - b.column);
|
||||
return { number: i + 1, name: pageName(page.name, i + 1), buttons };
|
||||
return { id, number: i + 1, name: pageName(page.name, i + 1), buttons };
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
@@ -266,17 +267,16 @@ function createPageBook() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The control at a page number, row and column right now, or null. */
|
||||
function at(number, row, column) {
|
||||
const page = pages.get(order[number - 1]);
|
||||
return (page && page.controls[row] && page.controls[row][column]) || null;
|
||||
/** One page by Companion's own page id (stable when pages are renumbered), or null. */
|
||||
function page(id) {
|
||||
return list().find((p) => p.id === id) || null;
|
||||
}
|
||||
|
||||
return {
|
||||
apply,
|
||||
list,
|
||||
locate,
|
||||
at,
|
||||
page,
|
||||
get loaded() {
|
||||
return order.length > 0;
|
||||
},
|
||||
@@ -303,4 +303,7 @@ function pageName(raw, number) {
|
||||
return `${number} ${name}`;
|
||||
}
|
||||
|
||||
module.exports = { createLink, createPageBook, pageName };
|
||||
/** Companion's navigation buttons: page up, page down, the page number. Never shown. */
|
||||
const NAV_TYPES = new Set(['pageup', 'pagedown', 'pagenum']);
|
||||
|
||||
module.exports = { createLink, createPageBook, pageName, NAV_TYPES };
|
||||
|
||||
Reference in New Issue
Block a user