From c227a8af9a28e0a88665d8ac9ee842ed22bc3b9c Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 19 Aug 2024 17:51:24 -0700 Subject: [PATCH] Use DPI to calculate screen center (#544) --- src/scripts/app.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index ee2b491c90..e09b13cbb8 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -2952,9 +2952,10 @@ export class ComfyApp { ) as Vector2 } - getCanvasCenter() { + getCanvasCenter(): Vector2 { + const dpi = Math.max(window.devicePixelRatio ?? 1, 1) const [x, y, w, h] = app.canvas.ds.visible_area - return [x + w / 2, y + h / 2] + return [x + w / dpi / 2, y + h / dpi / 2] } }