#57-1 Create one class from: KeystrokeAction, KeystrokeModifiersAction, KeystrokeWithModifiers, DualRoleKeystrokeAction with keeping the different types for binary serialization.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import {ClassArray} from '../ClassArray';
|
||||
import {UhkBuffer} from '../UhkBuffer';
|
||||
import {DualRoleKeystrokeAction} from './DualRoleKeystrokeAction';
|
||||
import {NoneAction} from './NoneAction';
|
||||
import {KeystrokeAction} from './KeystrokeAction';
|
||||
import {keyActionType, KeyActionId, KeyAction} from './KeyAction';
|
||||
import {KeystrokeModifiersAction} from './KeystrokeModifiersAction';
|
||||
import {KeystrokeWithModifiersAction} from './KeystrokeWithModifiersAction';
|
||||
import {SwitchLayerAction} from './SwitchLayerAction';
|
||||
import {SwitchKeymapAction} from './SwitchKeymapAction';
|
||||
import {MouseAction} from './MouseAction';
|
||||
@@ -19,12 +16,6 @@ export class KeyActions extends ClassArray<KeyAction> {
|
||||
return new NoneAction().fromJsObject(jsObject);
|
||||
case keyActionType.KeystrokeAction:
|
||||
return new KeystrokeAction().fromJsObject(jsObject);
|
||||
case keyActionType.KeystrokeModifiersAction:
|
||||
return new KeystrokeModifiersAction().fromJsObject(jsObject);
|
||||
case keyActionType.KeystrokeWithModifiersAction:
|
||||
return new KeystrokeWithModifiersAction().fromJsObject(jsObject);
|
||||
case keyActionType.DualRoleKeystrokeAction:
|
||||
return new DualRoleKeystrokeAction().fromJsObject(jsObject);
|
||||
case keyActionType.SwitchLayerAction:
|
||||
return new SwitchLayerAction().fromJsObject(jsObject);
|
||||
case keyActionType.SwitchKeymapAction:
|
||||
@@ -47,17 +38,13 @@ export class KeyActions extends ClassArray<KeyAction> {
|
||||
buffer.enableDump = false;
|
||||
}
|
||||
|
||||
if (keyActionFirstByte >= KeyActionId.KeystrokeAction && keyActionFirstByte < KeyActionId.LastKeystrokeAction) {
|
||||
return new KeystrokeAction().fromBinary(buffer);
|
||||
}
|
||||
|
||||
switch (keyActionFirstByte) {
|
||||
case KeyActionId.NoneAction:
|
||||
return new NoneAction().fromBinary(buffer);
|
||||
case KeyActionId.KeystrokeAction:
|
||||
return new KeystrokeAction().fromBinary(buffer);
|
||||
case KeyActionId.KeystrokeModifiersAction:
|
||||
return new KeystrokeModifiersAction().fromBinary(buffer);
|
||||
case KeyActionId.KeystrokeWithModifiersAction:
|
||||
return new KeystrokeWithModifiersAction().fromBinary(buffer);
|
||||
case KeyActionId.DualRoleKeystrokeAction:
|
||||
return new DualRoleKeystrokeAction().fromBinary(buffer);
|
||||
case KeyActionId.SwitchLayerAction:
|
||||
return new SwitchLayerAction().fromBinary(buffer);
|
||||
case KeyActionId.SwitchKeymapAction:
|
||||
|
||||
Reference in New Issue
Block a user