complete refactor

This commit is contained in:
Dylan Vorster
2018-01-08 20:50:54 +02:00
parent 6b55811312
commit 518f481776
32 changed files with 191 additions and 241 deletions

View File

@ -3,15 +3,13 @@ import { PortModel } from "./PortModel";
import * as _ from "lodash";
export class NodeModel extends BaseModel<BaseModelListener> {
nodeType: string;
x: number;
y: number;
extras: {};
ports: { [s: string]: PortModel };
constructor(nodeType: string = "default", id?: string) {
super(id);
this.nodeType = nodeType;
super(nodeType, id);
this.x = 0;
this.y = 0;
this.extras = {};
@ -52,7 +50,6 @@ export class NodeModel extends BaseModel<BaseModelListener> {
deSerialize(ob) {
super.deSerialize(ob);
this.nodeType = ob.type;
this.x = ob.x;
this.y = ob.y;
this.extras = ob.extras;
@ -60,7 +57,6 @@ export class NodeModel extends BaseModel<BaseModelListener> {
serialize() {
return _.merge(super.serialize(), {
type: this.nodeType,
x: this.x,
y: this.y,
extras: this.extras,
@ -117,8 +113,4 @@ export class NodeModel extends BaseModel<BaseModelListener> {
this.ports[port.name] = port;
return port;
}
getType(): string {
return this.nodeType;
}
}