Skip to content

Commit 4a7c955

Browse files
benceruleanluclaude
andcommitted
[bugfix] Fix link center dot hit detection when marker is disabled (#5135)
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 <[email protected]>
1 parent ba1fa1b commit 4a7c955

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib/litegraph/src/LGraphCanvas.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,10 @@ export class LGraphCanvas
24262426
pointer.onDragEnd = (e) => this.#processDraggedItems(e)
24272427
return
24282428
}
2429-
} else if (isInRectangle(x, y, centre[0] - 4, centre[1] - 4, 8, 8)) {
2429+
} else if (
2430+
this.linkMarkerShape !== LinkMarkerShape.None &&
2431+
isInRectangle(x, y, centre[0] - 4, centre[1] - 4, 8, 8)
2432+
) {
24302433
this.ctx.lineWidth = lineWidth
24312434

24322435
pointer.onClick = () => this.showLinkMenu(linkSegment, e)
@@ -4693,6 +4696,11 @@ export class LGraphCanvas
46934696

46944697
/** @returns If the pointer is over a link centre marker, the link segment it belongs to. Otherwise, `undefined`. */
46954698
#getLinkCentreOnPos(e: CanvasPointerEvent): LinkSegment | undefined {
4699+
// Skip hit detection if center markers are disabled
4700+
if (this.linkMarkerShape === LinkMarkerShape.None) {
4701+
return undefined
4702+
}
4703+
46964704
for (const linkSegment of this.renderedPaths) {
46974705
const centre = linkSegment._pos
46984706
if (!centre) continue

0 commit comments

Comments
 (0)