Add some copy constructors
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {assertUInt8} from '../assert';
|
||||
import {Serializable} from '../Serializable';
|
||||
import {UhkBuffer} from '../UhkBuffer';
|
||||
import {Layers} from './Layers';
|
||||
import { assertUInt8 } from '../assert';
|
||||
import { Serializable } from '../Serializable';
|
||||
import { UhkBuffer } from '../UhkBuffer';
|
||||
import { Layers } from './Layers';
|
||||
|
||||
export class Keymap extends Serializable<Keymap> {
|
||||
|
||||
@@ -18,6 +18,19 @@ export class Keymap extends Serializable<Keymap> {
|
||||
|
||||
layers: Layers;
|
||||
|
||||
constructor(keymap?: Keymap) {
|
||||
super();
|
||||
if (!keymap) {
|
||||
return;
|
||||
}
|
||||
this.id = keymap.id;
|
||||
this.name = keymap.name;
|
||||
this.description = keymap.description;
|
||||
this.abbreviation = keymap.abbreviation;
|
||||
this.isDefault = keymap.isDefault;
|
||||
this.layers = new Layers(keymap.layers);
|
||||
}
|
||||
|
||||
_fromJsObject(jsObject: any): Keymap {
|
||||
this.id = jsObject.id;
|
||||
this.isDefault = jsObject.isDefault;
|
||||
|
||||
Reference in New Issue
Block a user