Fix node highlighter to include title bar height

This commit is contained in:
AEmotionStudio
2026-01-10 16:47:18 -08:00
parent 11e350ae03
commit 1cd6bf9f29
4 changed files with 29 additions and 6 deletions
+17 -2
View File
@@ -109,11 +109,26 @@ export class CanvasHighlighter {
// Note: ctx passed to onDrawForeground is already transformed by LiteGraph to graph coordinates
// so we can draw using node.pos directly.
// In LiteGraph, node.size only represents the body dimensions (without title bar)
// The title bar height must be added to get the full visual node height
const LiteGraph = (window as any).LiteGraph;
const titleHeight = LiteGraph?.NODE_TITLE_HEIGHT ?? 30;
// Debug: Log values to browser console
console.log('[MagnifyGlass] Highlight debug:', {
titleHeight,
nodePos: node.pos,
nodeSize: node.size,
NODE_TITLE_HEIGHT: LiteGraph?.NODE_TITLE_HEIGHT
});
const padding = 10;
const x = node.pos[0] - padding;
const y = node.pos[1] - padding;
// Account for the title bar above the node body
const y = node.pos[1] - padding - titleHeight;
const w = node.size[0] + (padding * 2);
const h = node.size[1] + (padding * 2);
// Total node height = title bar + body size
const h = titleHeight + node.size[1] + (padding * 2);
// Draw large blue bar/border
ctx.lineWidth = 10; // Thicker border
+10 -2
View File
@@ -76,11 +76,19 @@ class CanvasHighlighter {
const node = app.graph.getNodeById(this.highlightedNodeId);
if (!node) return;
ctx.save();
const LiteGraph = window.LiteGraph;
const titleHeight = (LiteGraph == null ? void 0 : LiteGraph.NODE_TITLE_HEIGHT) ?? 30;
console.log("[MagnifyGlass] Highlight debug:", {
titleHeight,
nodePos: node.pos,
nodeSize: node.size,
NODE_TITLE_HEIGHT: LiteGraph == null ? void 0 : LiteGraph.NODE_TITLE_HEIGHT
});
const padding = 10;
const x = node.pos[0] - padding;
const y = node.pos[1] - padding;
const y = node.pos[1] - padding - titleHeight;
const w = node.size[0] + padding * 2;
const h = node.size[1] + padding * 2;
const h = titleHeight + node.size[1] + padding * 2;
ctx.lineWidth = 10;
ctx.strokeStyle = "#007bff";
ctx.lineJoin = "round";
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long