From 2d69a87419548164a9f6a115e00c574a55038f5e Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sat, 23 Nov 2024 02:57:37 +1100 Subject: [PATCH] Use device scaling for drag-from-link checks (#334) --- src/LGraphCanvas.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index 876ea29..6120fb1 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -2143,6 +2143,7 @@ export class LGraphCanvas { // Set the width of the line for isPointInStroke checks const { lineWidth } = this.ctx this.ctx.lineWidth = this.connections_width + 7 + const dpi = window?.devicePixelRatio || 1 for (const linkSegment of this.renderedPaths) { const centre = linkSegment._pos @@ -2152,7 +2153,7 @@ export class LGraphCanvas { if ( (e.shiftKey || e.altKey) && linkSegment.path && - this.ctx.isPointInStroke(linkSegment.path, x, y) + this.ctx.isPointInStroke(linkSegment.path, x * dpi, y * dpi) ) { if (e.shiftKey && !e.altKey) { const slot = linkSegment.origin_slot