Add some copy constructors

This commit is contained in:
Farkas József
2016-09-17 16:39:45 +02:00
parent 7464948f1c
commit 813714073e
6 changed files with 82 additions and 25 deletions

View File

@@ -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;