From a87dd87b8d608c2bec95e0eebd8a080373fd8e17 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu, 17 Mar 2022 05:54:58 +1300 Subject: [PATCH] Add Standard Brush Size Hotkey Functionality You can now use the bracket keys "[" and "]" to Increase and Decrease Brush Size similar to many other photo editing programs. --- lama_cleaner/app/src/Editor.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lama_cleaner/app/src/Editor.tsx b/lama_cleaner/app/src/Editor.tsx index 0cfe147..a75c1c7 100644 --- a/lama_cleaner/app/src/Editor.tsx +++ b/lama_cleaner/app/src/Editor.tsx @@ -450,6 +450,25 @@ export default function Editor(props: EditorProps) { } return undefined }, [showBrush, isPanning]) + + // Standard Hotkeys for Brush Size + useKeyPressEvent('[', () => { + setBrushSize(currentBrushSize => { + if (currentBrushSize > 10) { + return currentBrushSize - 10 + } + if (currentBrushSize <= 10 && currentBrushSize > 0) { + return currentBrushSize - 5 + } + return currentBrushSize + }) + }) + + useKeyPressEvent(']', () => { + setBrushSize(currentBrushSize => { + return currentBrushSize + 10 + }) + }) // Toggle clean/zoom tool on spacebar. useKeyPressEvent(