Place autocomplete using node layout offsets
tests / test (push) Canceled after 0s
tests / windows-storage (push) Canceled after 0s

This commit is contained in:
2026-10-15 11:03:25 +00:00
parent 1201c240e6
commit f999e77382
+6 -4
View File
@@ -339,10 +339,12 @@ function configure(node) {
autocompleteRange = { start: at, end: at + 1 };
const menu = el("div");
menu.style.cssText = "position:absolute;z-index:30;min-width:220px;max-width:310px;padding:5px;background:#25282b;border:1px solid #4b5960;border-radius:8px;box-shadow:0 8px 24px #000b;color:#e7edf0;pointer-events:auto";
const rect = prompt.getBoundingClientRect();
const parentRect = panel.getBoundingClientRect();
menu.style.left = `${Math.max(5, Math.min(panel.clientWidth - 230, rect.left - parentRect.left + 14))}px`;
menu.style.top = `${rect.top - parentRect.top + 26}px`;
// Use the DOM layout offsets rather than viewport rectangles. The
// node canvas scales/transforms the widget, so mixing a viewport
// rect with an absolute child can move the menu to another part
// of the node.
menu.style.left = `${Math.max(5, Math.min(panel.clientWidth - 230, (prompt.offsetLeft || 0) + 14))}px`;
menu.style.top = `${Math.max(5, (prompt.offsetTop || 0) + 26)}px`;
const connected = Array.from({ length: 9 }, (_, offset) => offset + 1)
.filter((index) => node.inputs?.some((input) => input.name === `reference_image_${index}` && input.link != null));
const addOption = (content, title, action) => {