A full-window button beside Dock (and a double-click on the title bar) makes the window fill the ComfyUI page, remembered; it is neither dragged nor resized then, and docking turns it off. Voice-over: one row per line card, a divider between the lines and the generating side (dragged and remembered, ui_split_bar.js; about half each by default), "Into your own workflow" folded, who reads and their voices on one row, the how-to line only until there are lines. On a wide side the modes' scale and numbers are shown open unless the fold was closed before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.6 KiB
JavaScript
34 lines
1.6 KiB
JavaScript
/**
|
|
* A bar between two columns that shares the width: dragged, the right column's width goes
|
|
* into the CSS variable `prop` on `owner` and is remembered under `key`; a double-click goes
|
|
* back to the stylesheet's default. The Script Director's divider between its line cards and
|
|
* the generating side (ui_script_director.js).
|
|
*/
|
|
|
|
/** `body`: the row holding both columns; `min` / `rest`: px kept by the right and the left column. */
|
|
export function bindSplitBar(bar, { owner, body, prop, key, min = 320, rest = 340 }) {
|
|
let width = 0;
|
|
try { width = Number(localStorage.getItem(key)) || 0; } catch (_) { /* the default share */ }
|
|
if (width) owner.style.setProperty(prop, `${width}px`);
|
|
bar.addEventListener('pointerdown', (e) => {
|
|
e.preventDefault();
|
|
bar.setPointerCapture(e.pointerId);
|
|
const right = body.getBoundingClientRect().right;
|
|
const move = (ev) => {
|
|
width = Math.round(Math.max(min, Math.min(body.clientWidth - rest, right - ev.clientX)));
|
|
owner.style.setProperty(prop, `${width}px`);
|
|
};
|
|
const up = () => {
|
|
bar.removeEventListener('pointermove', move);
|
|
bar.removeEventListener('pointerup', up);
|
|
try { localStorage.setItem(key, String(width)); } catch (_) { /* convenience only */ }
|
|
};
|
|
bar.addEventListener('pointermove', move);
|
|
bar.addEventListener('pointerup', up);
|
|
});
|
|
bar.addEventListener('dblclick', () => {
|
|
owner.style.removeProperty(prop);
|
|
try { localStorage.removeItem(key); } catch (_) { /* convenience only */ }
|
|
});
|
|
}
|