forked from projectstorm/react-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dylan Vorster
committed
Feb 18, 2017
1 parent
a6621c9
commit 8f207c5
Showing
51 changed files
with
2,430 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @author Dylan Vorster | ||
*/ | ||
export declare class BaseListener { | ||
} | ||
export declare class BaseEnity<T extends BaseListener> { | ||
listeners: { | ||
[s: string]: T; | ||
}; | ||
id: string; | ||
constructor(); | ||
getID(): string; | ||
clearListeners(): void; | ||
itterateListeners(cb: (t: T) => any): void; | ||
removeListener(listener: string): boolean; | ||
addListener(listener: T): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use strict"; | ||
var Toolkit_1 = require("./Toolkit"); | ||
/** | ||
* @author Dylan Vorster | ||
*/ | ||
var BaseListener = (function () { | ||
function BaseListener() { | ||
} | ||
return BaseListener; | ||
}()); | ||
exports.BaseListener = BaseListener; | ||
var BaseEnity = (function () { | ||
function BaseEnity() { | ||
this.listeners = {}; | ||
this.id = Toolkit_1.Toolkit.UID(); | ||
} | ||
BaseEnity.prototype.getID = function () { | ||
return this.id; | ||
}; | ||
BaseEnity.prototype.clearListeners = function () { | ||
this.listeners = {}; | ||
}; | ||
BaseEnity.prototype.itterateListeners = function (cb) { | ||
for (var i in this.listeners) { | ||
cb(this.listeners[i]); | ||
} | ||
}; | ||
BaseEnity.prototype.removeListener = function (listener) { | ||
if (this.listeners[listener]) { | ||
delete this.listeners[listener]; | ||
return true; | ||
} | ||
return false; | ||
}; | ||
BaseEnity.prototype.addListener = function (listener) { | ||
var uid = Toolkit_1.Toolkit.UID(); | ||
this.listeners[uid] = listener; | ||
return uid; | ||
}; | ||
return BaseEnity; | ||
}()); | ||
exports.BaseEnity = BaseEnity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { BaseEnity, BaseListener } from "./BaseEntity"; | ||
export interface BaseModelListener extends BaseListener { | ||
selectionChanged?(): any; | ||
entityRemoved?(): any; | ||
} | ||
/** | ||
* @author Dylan Vorster | ||
*/ | ||
export declare class BaseModel extends BaseEnity<BaseModelListener> { | ||
selected: boolean; | ||
constructor(); | ||
getID(): string; | ||
isSelected(): boolean; | ||
setSelected(selected: boolean): void; | ||
remove(): void; | ||
} | ||
export declare class PointModel extends BaseModel { | ||
x: number; | ||
y: number; | ||
link: LinkModel; | ||
constructor(link: LinkModel, points: { | ||
x: number; | ||
y: number; | ||
}); | ||
updateLocation(points: { | ||
x: number; | ||
y: number; | ||
}): void; | ||
getX(): number; | ||
getY(): number; | ||
getLink(): LinkModel; | ||
} | ||
export declare class LinkModel extends BaseModel { | ||
linkType: string; | ||
sourcePort: PortModel | null; | ||
targetPort: PortModel | null; | ||
points: PointModel[]; | ||
extras: {}; | ||
constructor(); | ||
isLastPoint(point: PointModel): boolean; | ||
getPointIndex(point: PointModel): number; | ||
getPointModel(id: string): PointModel | null; | ||
getFirstPoint(): PointModel; | ||
getLastPoint(): PointModel; | ||
setSourcePort(port: PortModel): void; | ||
setTargetPort(port: PortModel): void; | ||
getPoints(): PointModel[]; | ||
setPoints(points: PointModel[]): void; | ||
addPoint(pointModel: PointModel, index?: number): void; | ||
getType(): string; | ||
} | ||
export declare class PortModel extends BaseModel { | ||
name: string; | ||
parentNode: NodeModel; | ||
links: { | ||
[id: string]: LinkModel; | ||
}; | ||
constructor(name: string); | ||
getName(): string; | ||
getParent(): NodeModel; | ||
setParentNode(node: NodeModel): void; | ||
removeLink(link: LinkModel): void; | ||
addLink(link: LinkModel): void; | ||
getLinks(): { | ||
[id: string]: LinkModel; | ||
}; | ||
} | ||
export declare class NodeModel extends BaseModel { | ||
nodeType: string; | ||
canDelete: boolean; | ||
x: number; | ||
y: number; | ||
extras: {}; | ||
ports: { | ||
[s: string]: PortModel; | ||
}; | ||
constructor(); | ||
getPort(name: string): PortModel | null; | ||
getPorts(): { | ||
[s: string]: PortModel; | ||
}; | ||
removePort(port: PortModel): void; | ||
addPort(port: PortModel): PortModel; | ||
getType(): string; | ||
} |
Oops, something went wrong.