From 00ccfd4cc10de98ea22e91a8ffa71208de3c2a08 Mon Sep 17 00:00:00 2001 From: digital-divas-admin Date: Sun, 15 Feb 2026 22:50:37 -0500 Subject: [PATCH] Fix toggle alignment using getConnectionPos for exact slot positions Instead of manually calculating slot Y positions with a formula that varies across LiteGraph versions, use getConnectionPos() which returns the exact coordinates LiteGraph uses for drawing slot connectors. This guarantees perfect alignment between toggles and their input slots. Co-Authored-By: Claude Opus 4.6 --- web/dd_image_power_selector.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/dd_image_power_selector.js b/web/dd_image_power_selector.js index 664ad94..4731f9e 100644 --- a/web/dd_image_power_selector.js +++ b/web/dd_image_power_selector.js @@ -59,9 +59,10 @@ app.registerExtension({ // --- Helper: get Y position for an input slot (local coords) --- nodeType.prototype._getSlotY = function (slotIndex) { - const slotHeight = LiteGraph.NODE_SLOT_HEIGHT || 20; - // Standard LiteGraph slot position: center of slot + 4px nudge - return slotHeight * (slotIndex + 0.5) + 4; + // Use LiteGraph's own getConnectionPos for exact slot position, + // then convert from graph-space to local node-space. + const pos = this.getConnectionPos(true, slotIndex); + return pos[1] - this.pos[1]; }; // --- onNodeCreated: set up dynamic slots, toggles, and buttons ---