Remove NATIVE_NUMERIC_WIDGET_NAMES exclusion list (rotate_deg, scale, strength, width, height, rotate). Excluded widgets were left visible as native LiteGraph sliders at the bottom of nodes, creating vertical empty space and duplicate UI (notably CameraShake/Transform/Spherize). Also includes prior session work: P1-P4 UX improvements, video preview anti-blink/anti-stutter fixes in source.ts, README and REFACTO docs cleanup.
40 lines
1015 B
JavaScript
40 lines
1015 B
JavaScript
function attachDblClickReset(element, options) {
|
|
if (!element) return;
|
|
const handler = (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
const v = options.defaultValue;
|
|
const el = element;
|
|
if ("value" in el) {
|
|
if (typeof v === "boolean") {
|
|
if ("checked" in el) el.checked = v;
|
|
el.value = v ? "true" : "false";
|
|
} else {
|
|
el.value = String(v);
|
|
}
|
|
}
|
|
if (options.fireEvents !== false) {
|
|
try {
|
|
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
} catch {
|
|
}
|
|
try {
|
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
} catch {
|
|
}
|
|
}
|
|
options.onReset(v);
|
|
};
|
|
element.addEventListener("dblclick", handler);
|
|
element.__imageopsDblClickReset = handler;
|
|
}
|
|
function attachDblClickResets(bindings) {
|
|
for (const b of bindings) {
|
|
attachDblClickReset(b.element, { defaultValue: b.defaultValue, onReset: b.onReset });
|
|
}
|
|
}
|
|
export {
|
|
attachDblClickReset,
|
|
attachDblClickResets
|
|
};
|