forked from Blendman974/faceclaw
Add configuration options to the glanceboard system card and music card
This commit is contained in:
1 parent
13da595de0
commit
df95cc4064
12 files changed
+367
-107
No files matched your search
@@ -182,6 +182,16 @@ export function drawDenseBatteries(
|
||||
return x + DENSE_COLUMN_GAP;
|
||||
}
|
||||
|
||||
/** The width drawDenseBatteries would take for `items` (0 when empty), to place the block before drawing it. */
|
||||
export function denseBatteriesWidth(items: readonly DenseBatteryItem[]): number {
|
||||
let width = 0;
|
||||
for (let end = items.length; end > 0; end -= 2) {
|
||||
const column = items.slice(Math.max(0, end - 2), end);
|
||||
width += Math.max(...column.map((item) => DEVICE_ICONS[item.device].width)) + DENSE_ICON_GAP + BATTERY_ICON_WIDTH + DENSE_COLUMN_GAP;
|
||||
}
|
||||
return Math.max(0, width - DENSE_COLUMN_GAP);
|
||||
}
|
||||
|
||||
/** The empty outline, built once from the geometry constants. */
|
||||
const EMPTY_BATTERY_ICON = buildEmptyBattery();
|
||||
|
||||
|
||||
Reference in new issue
Block a user