Adds brush color alpha hotkey

This commit is contained in:
psychedelicious 2022-11-24 14:51:35 +11:00 committed by blessedcoolant
parent db188cd3c3
commit 62ac725ba9
2 changed files with 46 additions and 2 deletions

View File

@ -86,7 +86,7 @@ const IAICanvasToolChooserOptions = () => {
);
useHotkeys(
['['],
['BracketLeft'],
() => {
dispatch(setBrushSize(Math.max(brushSize - 5, 5)));
},
@ -98,7 +98,7 @@ const IAICanvasToolChooserOptions = () => {
);
useHotkeys(
[']'],
['BracketRight'],
() => {
dispatch(setBrushSize(Math.min(brushSize + 5, 500)));
},
@ -109,6 +109,40 @@ const IAICanvasToolChooserOptions = () => {
[brushSize]
);
useHotkeys(
['shift+BracketLeft'],
() => {
dispatch(
setBrushColor({
...brushColor,
a: _.clamp(brushColor.a - 0.05, 0.05, 1),
})
);
},
{
enabled: () => true,
preventDefault: true,
},
[brushColor]
);
useHotkeys(
['shift+BracketRight'],
() => {
dispatch(
setBrushColor({
...brushColor,
a: _.clamp(brushColor.a + 0.05, 0.05, 1),
})
);
},
{
enabled: () => true,
preventDefault: true,
},
[brushColor]
);
const handleSelectBrushTool = () => dispatch(setTool('brush'));
const handleSelectEraserTool = () => dispatch(setTool('eraser'));
const handleSelectColorPickerTool = () => dispatch(setTool('colorPicker'));

View File

@ -158,6 +158,16 @@ export default function HotkeysModal({ children }: HotkeysModalProps) {
desc: 'Increases the size of the canvas brush/eraser',
hotkey: ']',
},
{
title: 'Decrease Brush Opacity',
desc: 'Decreases the opacity of the canvas brush',
hotkey: 'Shift + [',
},
{
title: 'Increase Brush Opacity',
desc: 'Increases the opacity of the canvas brush',
hotkey: 'Shift + ]',
},
{
title: 'Move Tool',
desc: 'Allows canvas navigation',