From 51bc7cc8aeb054688ea6eb6fbc1960e9d1ff6e1b Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Tue, 3 Feb 2026 20:17:04 +0100 Subject: [PATCH] fix(services): ignore Alt on Ctrl shortcuts --- lib/core/services/keyboard_service.dart | 9 +++++++++ .../services/crop_desktop_interaction_manager.dart | 4 +++- .../services/desktop_interaction_manager.dart | 4 +++- .../services/paint_desktop_interaction_manager.dart | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/core/services/keyboard_service.dart b/lib/core/services/keyboard_service.dart index b8d8e36d2..aa44feb0a 100644 --- a/lib/core/services/keyboard_service.dart +++ b/lib/core/services/keyboard_service.dart @@ -35,4 +35,13 @@ class KeyboardService { bool get isShiftPressed => isKeyPressed(LogicalKeyboardKey.shiftLeft) || isKeyPressed(LogicalKeyboardKey.shiftRight); + + /// Returns `true` if either Alt key is currently pressed. + /// + /// This includes: + /// - [LogicalKeyboardKey.altLeft] + /// - [LogicalKeyboardKey.altRight] + bool get isAltPressed => + isKeyPressed(LogicalKeyboardKey.altLeft) || + isKeyPressed(LogicalKeyboardKey.altRight); } diff --git a/lib/features/crop_rotate_editor/services/crop_desktop_interaction_manager.dart b/lib/features/crop_rotate_editor/services/crop_desktop_interaction_manager.dart index 43be3effc..1388a16ee 100644 --- a/lib/features/crop_rotate_editor/services/crop_desktop_interaction_manager.dart +++ b/lib/features/crop_rotate_editor/services/crop_desktop_interaction_manager.dart @@ -77,7 +77,9 @@ class CropDesktopInteractionManager { _shiftDown = true; break; case 'Z': - if (_ctrlDown) onUndoRedo(!_shiftDown); + if (_ctrlDown && !HardwareKeyboard.instance.isAltPressed) { + onUndoRedo(!_shiftDown); + } break; } } else if (event is KeyUpEvent) { diff --git a/lib/features/main_editor/services/desktop_interaction_manager.dart b/lib/features/main_editor/services/desktop_interaction_manager.dart index de5237b42..c04d11c3e 100644 --- a/lib/features/main_editor/services/desktop_interaction_manager.dart +++ b/lib/features/main_editor/services/desktop_interaction_manager.dart @@ -124,7 +124,9 @@ class DesktopInteractionManager { _keyboardRotate(isLeftRotation: false, selectedLayers: selectedLayers); break; case 'Z': - if (_keyboard.isCtrlPressed) onUndoRedo(!_keyboard.isShiftPressed); + if (_keyboard.isCtrlPressed && !_keyboard.isAltPressed) { + onUndoRedo(!_keyboard.isShiftPressed); + } break; } diff --git a/lib/features/paint_editor/services/paint_desktop_interaction_manager.dart b/lib/features/paint_editor/services/paint_desktop_interaction_manager.dart index 45dd02e20..f1e5b593e 100644 --- a/lib/features/paint_editor/services/paint_desktop_interaction_manager.dart +++ b/lib/features/paint_editor/services/paint_desktop_interaction_manager.dart @@ -46,7 +46,9 @@ class PaintDesktopInteractionManager { _shiftDown = true; break; case 'Z': - if (_ctrlDown) onUndoRedo(!_shiftDown); + if (_ctrlDown && !HardwareKeyboard.instance.isAltPressed) { + onUndoRedo(!_shiftDown); + } break; } } else if (event is KeyUpEvent) {