File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
Graph/Node/Patch/Type/Interaction/Keyboard Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import SwiftUI
10
10
11
11
// MARK: PATCH SHORTCUTS
12
12
13
+ // Require CMD
13
14
let ADD_PACK_NODE_SHORTCUT : KeyEquivalent = " P "
14
15
let ADD_UNPACK_NODE_SHORTCUT : KeyEquivalent = " U "
15
16
@@ -88,29 +89,35 @@ extension Character {
88
89
}
89
90
}
90
91
91
- func patchFromShortcutKey( isShiftDown: Bool ) -> Patch ? {
92
+ func patchFromShortcutKey( isShiftDown: Bool ,
93
+ isCommandDown: Bool ) -> Patch ? {
92
94
log ( " patchFromShortcutKey: isShiftDown: \( isShiftDown) " )
95
+ log ( " patchFromShortcutKey: isCommandDown: \( isCommandDown) " )
93
96
94
97
let lowercaseCharacter = self . lowercased ( ) . toCharacter
95
98
96
99
if isShiftDown {
97
100
switch lowercaseCharacter {
98
- // Always requires shift ?
99
101
case NOT_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
100
102
return . not
101
103
default :
102
104
break
103
105
}
104
106
}
105
107
108
+ if isCommandDown {
109
+ switch lowercaseCharacter {
110
+ case ADD_PACK_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
111
+ return . sizePack
112
+ case ADD_UNPACK_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
113
+ return . sizeUnpack
114
+ default :
115
+ break
116
+ }
117
+ }
118
+
106
119
switch lowercaseCharacter {
107
120
108
- case ADD_PACK_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
109
- return . sizePack
110
-
111
- case ADD_UNPACK_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
112
- return . sizeUnpack
113
-
114
121
case ADD_SPLITTER_NODE_SHORTCUT . character. lowercased ( ) . toCharacter:
115
122
return . splitter
116
123
Original file line number Diff line number Diff line change @@ -163,7 +163,9 @@ extension StitchStore {
163
163
// Else: If option is not required for shortcuts, and shortcuts are not disabled, try to treat the keypress as a shortcut.
164
164
else if !self . isOptionRequiredForShortcut,
165
165
!document. shouldDisablePatchShortcuts,
166
- let patch = char. patchFromShortcutKey ( isShiftDown: document. keypressState. isShiftPressed) {
166
+ let patch = char. patchFromShortcutKey (
167
+ isShiftDown: document. keypressState. isShiftPressed,
168
+ isCommandDown: document. keypressState. isCommandPressed) {
167
169
168
170
if document. reduxFocusedField? . isInputPortSelected ?? false {
169
171
document. nodeCreatedWhileInputSelected ( patch: patch)
You can’t perform that action at this time.
0 commit comments