Skip to content

Commit

Permalink
Use device scaling for drag-from-link checks
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered committed Nov 22, 2024
1 parent 1f572b4 commit 4f48853
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/LGraphCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4f48853

Please sign in to comment.