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.
This commit is contained in:
blessedcoolant 2022-03-17 05:54:58 +13:00 committed by GitHub
parent 61fcffda94
commit a87dd87b8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(