fix: Into Flake Data (Select) hidden widgets catching pointer events (#214)
The previous approach (`hideIntoWidgets`) flagged optional widgets as hidden and zeroed their compute size, but left them in node.widgets. Canvas-drawn LiteGraph widgets that remain attached to the node still have a hit-test region — they intercepted clicks meant for the new custom dropdown / + button, changing the cursor and opening the hidden widget's editor instead of the dropdown. Rename to `removeIntoWidgets` and actually splice these widgets out of node.widgets so there is no hit region left. Add an idempotency guard on setupIntoFlakeDataSelect so the second call (from onConfigure) is a no-op rather than re-adding the DOM widget twice. Closes #214
This commit is contained in:
@@ -198,23 +198,29 @@ const OPTIONAL_WIDGET_NAMES = new Set([
|
||||
"filename_prefix", "width", "height", "steps", "cfg", "sampler_name", "scheduler"
|
||||
]);
|
||||
|
||||
function hideIntoWidgets(node) {
|
||||
function removeIntoWidgets(node) {
|
||||
if (!node.widgets) return;
|
||||
for (const w of node.widgets) {
|
||||
for (let i = node.widgets.length - 1; i >= 0; i--) {
|
||||
const w = node.widgets[i];
|
||||
if (!OPTIONAL_WIDGET_NAMES.has(w.name)) continue;
|
||||
w.computeSize = () => [0, -4];
|
||||
w.type = "hidden";
|
||||
w.hidden = true;
|
||||
if (w.element) { w.element.remove(); w.element = null; }
|
||||
if (w.inputEl) { w.inputEl.remove(); w.inputEl = null; }
|
||||
node.widgets.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
export function setupIntoFlakeDataSelect(node) {
|
||||
if (!node.properties) node.properties = {};
|
||||
if (node._intoSetupDone) {
|
||||
node._intoPinUpdate?.();
|
||||
return;
|
||||
}
|
||||
node._intoSetupDone = true;
|
||||
|
||||
// Hide auto-created widgets for optional fields — pins are managed dynamically.
|
||||
hideIntoWidgets(node);
|
||||
// Fully remove auto-created widgets for optional fields — pins are managed dynamically.
|
||||
// (Previously these were hidden but the canvas-drawn widgets still caught clicks,
|
||||
// hijacking clicks meant for the dropdown / + button.)
|
||||
removeIntoWidgets(node);
|
||||
|
||||
// Remove any pre-existing optional inputs that Python adds automatically.
|
||||
// Keep only flake_data.
|
||||
|
||||
Reference in New Issue
Block a user