From fc9a9a2571c6a5a323e967b6cde090d59391a9a2 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Mon, 31 Jul 2023 16:36:30 +0200 Subject: [PATCH] fix: eye-dropper not working with app offset correctly on non-1 dPR (#6835) --- src/components/EyeDropper.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/EyeDropper.tsx b/src/components/EyeDropper.tsx index 9e452ce8..8e3e21ec 100644 --- a/src/components/EyeDropper.tsx +++ b/src/components/EyeDropper.tsx @@ -77,8 +77,8 @@ export const EyeDropper: React.FC<{ colorPreviewDiv.style.left = `${clientX + 20}px`; const pixel = ctx.getImageData( - clientX * window.devicePixelRatio - appState.offsetLeft, - clientY * window.devicePixelRatio - appState.offsetTop, + (clientX - appState.offsetLeft) * window.devicePixelRatio, + (clientY - appState.offsetTop) * window.devicePixelRatio, 1, 1, ).data;