From 4a7c955a1597aefdb272a275be16d9a1a1f968ba Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Wed, 20 Aug 2025 19:06:25 -0400 Subject: [PATCH] [bugfix] Fix link center dot hit detection when marker is disabled (#5135) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When linkMarkerShape is set to None, clicks were still being detected on the invisible center dot. This fix adds proper checks to skip hit detection when the center marker is disabled. Fixes center dot hit detection issue 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude --- src/lib/litegraph/src/LGraphCanvas.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/litegraph/src/LGraphCanvas.ts b/src/lib/litegraph/src/LGraphCanvas.ts index 3a26dfdc21..18737d23a4 100644 --- a/src/lib/litegraph/src/LGraphCanvas.ts +++ b/src/lib/litegraph/src/LGraphCanvas.ts @@ -2426,7 +2426,10 @@ export class LGraphCanvas pointer.onDragEnd = (e) => this.#processDraggedItems(e) return } - } else if (isInRectangle(x, y, centre[0] - 4, centre[1] - 4, 8, 8)) { + } else if ( + this.linkMarkerShape !== LinkMarkerShape.None && + isInRectangle(x, y, centre[0] - 4, centre[1] - 4, 8, 8) + ) { this.ctx.lineWidth = lineWidth pointer.onClick = () => this.showLinkMenu(linkSegment, e) @@ -4693,6 +4696,11 @@ export class LGraphCanvas /** @returns If the pointer is over a link centre marker, the link segment it belongs to. Otherwise, `undefined`. */ #getLinkCentreOnPos(e: CanvasPointerEvent): LinkSegment | undefined { + // Skip hit detection if center markers are disabled + if (this.linkMarkerShape === LinkMarkerShape.None) { + return undefined + } + for (const linkSegment of this.renderedPaths) { const centre = linkSegment._pos if (!centre) continue