Add isModifierActive helper function to actions with modifier mask.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import {KeyModifiers} from './KeystrokeModifiersAction';
|
||||
|
||||
class KeystrokeWithModifiersAction extends KeyAction {
|
||||
|
||||
// @assertUInt8
|
||||
@@ -37,4 +39,8 @@ class KeystrokeWithModifiersAction extends KeyAction {
|
||||
toString(): string {
|
||||
return `<KeystrokeWithModifiersAction scancode="${this.scancode}" modifierMask="${this.modifierMask}">`;
|
||||
}
|
||||
|
||||
isModifierActive(modifier: KeyModifiers): boolean {
|
||||
return (this.modifierMask & modifier) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user