@@ -47,16 +47,36 @@ function parseKeyDescription(keyDescription: string): KeyPressDecl {
47
47
let keys = keyDescription . replace ( / [ ( ) ] / g, "" ) . split ( ":" ) ;
48
48
for ( let key of keys ) {
49
49
if ( key == "Cmd" ) {
50
+ if ( PLATFORM == PlatformMacOS ) {
51
+ rtn . mods . Meta = true ;
52
+ } else {
53
+ rtn . mods . Alt = true ;
54
+ }
50
55
rtn . mods . Cmd = true ;
51
56
} else if ( key == "Shift" ) {
52
57
rtn . mods . Shift = true ;
53
58
} else if ( key == "Ctrl" ) {
54
59
rtn . mods . Ctrl = true ;
55
60
} else if ( key == "Option" ) {
61
+ if ( PLATFORM == PlatformMacOS ) {
62
+ rtn . mods . Alt = true ;
63
+ } else {
64
+ rtn . mods . Meta = true ;
65
+ }
56
66
rtn . mods . Option = true ;
57
67
} else if ( key == "Alt" ) {
68
+ if ( PLATFORM == PlatformMacOS ) {
69
+ rtn . mods . Option = true ;
70
+ } else {
71
+ rtn . mods . Cmd = true ;
72
+ }
58
73
rtn . mods . Alt = true ;
59
74
} else if ( key == "Meta" ) {
75
+ if ( PLATFORM == PlatformMacOS ) {
76
+ rtn . mods . Cmd = true ;
77
+ } else {
78
+ rtn . mods . Option = true ;
79
+ }
60
80
rtn . mods . Meta = true ;
61
81
} else {
62
82
let { key : parsedKey , type : keyType } = parseKey ( key ) ;
@@ -138,10 +158,10 @@ function isInputEvent(event: WaveKeyboardEvent): boolean {
138
158
139
159
function checkKeyPressed ( event : WaveKeyboardEvent , keyDescription : string ) : boolean {
140
160
let keyPress = parseKeyDescription ( keyDescription ) ;
141
- if ( ! keyPress . mods . Alt && notMod ( keyPress . mods . Option , event . option ) ) {
161
+ if ( notMod ( keyPress . mods . Option , event . option ) ) {
142
162
return false ;
143
163
}
144
- if ( ! keyPress . mods . Meta && notMod ( keyPress . mods . Cmd , event . cmd ) ) {
164
+ if ( notMod ( keyPress . mods . Cmd , event . cmd ) ) {
145
165
return false ;
146
166
}
147
167
if ( notMod ( keyPress . mods . Shift , event . shift ) ) {
@@ -150,10 +170,10 @@ function checkKeyPressed(event: WaveKeyboardEvent, keyDescription: string): bool
150
170
if ( notMod ( keyPress . mods . Ctrl , event . control ) ) {
151
171
return false ;
152
172
}
153
- if ( keyPress . mods . Alt && ! event . alt ) {
173
+ if ( notMod ( keyPress . mods . Alt , event . alt ) ) {
154
174
return false ;
155
175
}
156
- if ( keyPress . mods . Meta && ! event . meta ) {
176
+ if ( notMod ( keyPress . mods . Meta , event . meta ) ) {
157
177
return false ;
158
178
}
159
179
let eventKey = "" ;
0 commit comments