From 9049f6b10a003c3eea85e22572d08b637df6d60d Mon Sep 17 00:00:00 2001 From: Ategon Date: Sun, 12 Jul 2026 01:38:21 -0400 Subject: [PATCH] Separate color pic kevents into two different events --- packages/client/src/components/CanvasWrapper.tsx | 4 ++-- packages/client/src/components/Toolbar/Palette.tsx | 10 +--------- packages/client/src/lib/keybinds.ts | 8 +++++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/client/src/components/CanvasWrapper.tsx b/packages/client/src/components/CanvasWrapper.tsx index c4247d9..449761f 100644 --- a/packages/client/src/components/CanvasWrapper.tsx +++ b/packages/client/src/components/CanvasWrapper.tsx @@ -444,7 +444,7 @@ const CanvasInner = () => { const zoomInSmall = () => zoomBy(KEYBOARD_ZOOM_SMALL_STEP); KeybindManager.on("PIXEL_WHOIS", handlePixelWhois); - KeybindManager.on("PICK_COLOR", handlePickPixel); + KeybindManager.on("PICK_CANVAS_COLOR", handlePickPixel); KeybindManager.on("CAPTURE_CANVAS", captureCanvas); KeybindManager.on("CAPTURE_VIEW", captureView); KeybindManager.on("CAPTURE_REGION", captureRegion); @@ -456,7 +456,7 @@ const CanvasInner = () => { return () => { KeybindManager.off("PIXEL_WHOIS", handlePixelWhois); - KeybindManager.off("PICK_COLOR", handlePickPixel); + KeybindManager.off("PICK_CANVAS_COLOR", handlePickPixel); KeybindManager.off("CAPTURE_CANVAS", captureCanvas); KeybindManager.off("CAPTURE_VIEW", captureView); KeybindManager.off("CAPTURE_REGION", captureRegion); diff --git a/packages/client/src/components/Toolbar/Palette.tsx b/packages/client/src/components/Toolbar/Palette.tsx index aad1585..33bd8da 100644 --- a/packages/client/src/components/Toolbar/Palette.tsx +++ b/packages/client/src/components/Toolbar/Palette.tsx @@ -465,15 +465,7 @@ export const Palette = () => { PaletteLib.swapSelectedColors(); }; - const handlePickColorKeybind = ({ - clientX, - clientY, - }: { - clientX: number; - clientY: number; - }) => { - if (clientX >= 0 && clientY >= 0) return; - + const handlePickColorKeybind = () => { setPickColorPreview(null); setPickColorMode(true); }; diff --git a/packages/client/src/lib/keybinds.ts b/packages/client/src/lib/keybinds.ts index 15a0742..8d7f101 100644 --- a/packages/client/src/lib/keybinds.ts +++ b/packages/client/src/lib/keybinds.ts @@ -174,9 +174,6 @@ const KEYBINDS = enforceObjectType({ }, ], PICK_COLOR: [ - { - key: "MCLICK", - }, { key: "KeyC", ctrl: false, @@ -185,6 +182,11 @@ const KEYBINDS = enforceObjectType({ shift: false, }, ], + PICK_CANVAS_COLOR: [ + { + key: "MCLICK", + }, + ], MOD_SELECT: [ { key: "LCLICK", -- GitLab