From fdb125b294660f37f9b22e80259e746a7186f303 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:52:17 +1000 Subject: [PATCH] feat(ui): alt quick switches to color picker --- .../src/features/controlLayers/konva/CanvasToolModule.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasToolModule.ts b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasToolModule.ts index 2c9eba8b07..f98acc9cef 100644 --- a/invokeai/frontend/web/src/features/controlLayers/konva/CanvasToolModule.ts +++ b/invokeai/frontend/web/src/features/controlLayers/konva/CanvasToolModule.ts @@ -864,6 +864,10 @@ export class CanvasToolModule extends CanvasModuleABC { this.manager.stateApi.$spaceKey.set(true); this.manager.stateApi.$lastCursorPos.set(null); this.manager.stateApi.$lastMouseDownPos.set(null); + } else if (e.key === 'Alt') { + // Select the color picker on alt key down + this.manager.stateApi.$toolBuffer.set(this.manager.stateApi.$tool.get()); + this.manager.stateApi.$tool.set('colorPicker'); } }; @@ -880,6 +884,11 @@ export class CanvasToolModule extends CanvasModuleABC { this.manager.stateApi.$tool.set(toolBuffer ?? 'move'); this.manager.stateApi.$toolBuffer.set(null); this.manager.stateApi.$spaceKey.set(false); + } else if (e.key === 'Alt') { + // Revert the tool to the previous tool on alt key up + const toolBuffer = this.manager.stateApi.$toolBuffer.get(); + this.manager.stateApi.$tool.set(toolBuffer ?? 'move'); + this.manager.stateApi.$toolBuffer.set(null); } };