From 83fb246119f0a25a7551ec2771e534c706407efb Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 2 Mar 2025 23:06:15 -0700 Subject: [PATCH] Fix Selection Marquee display is offset when DPI < 1 (#692) Fixes https://github.com/Comfy-Org/ComfyUI_frontend/issues/2481. The canvas scaling behavior is not consistent with DPI which is the source of many bugs. To verify, add console log somewhere: --- src/LGraphCanvas.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts index cfd563d71..b22121586 100644 --- a/src/LGraphCanvas.ts +++ b/src/LGraphCanvas.ts @@ -4179,7 +4179,7 @@ export class LGraphCanvas implements ConnectionColorContext { if (eDown && eMove) { // Do not scale the selection box const transform = ctx.getTransform() - const ratio = window.devicePixelRatio + const ratio = Math.max(1, window.devicePixelRatio) ctx.setTransform(ratio, 0, 0, ratio, 0, 0) const x = eDown.safeOffsetX