forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jointjs.d.ts
135 lines (113 loc) · 4.44 KB
/
jointjs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// Type definitions for Joint JS 0.9.3
// Project: http://www.jointjs.com/
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>, Ewout Van Gossum <https://github.com/DenEwout>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module joint {
module dia {
interface IElementSize {
width: number;
height: number;
}
class Graph extends Backbone.Model {
addCell(cell:Cell) : void;
addCells(cells:Cell[]) : void;
initialize() : void;
fromJSON(json:any) : void;
toJSON() : Object;
clear() : void;
getConnectedLinks(cell:Cell, opt?:any):Link[];
disconnectLinks(cell:Cell) : void;
removeLinks(cell:Cell) : void;
findModelsFromPoint(point:{x : number; y: number}):Element[];
}
class Cell extends Backbone.Model {
toJSON() : Object;
remove(options?:any) : void;
toFront() : void;
toBack() : void;
embed(cell:Cell) : void;
unembed(cell:Cell) : void;
getEmbeddedCells():Cell[];
clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[].
attr(attrs:any):Cell;
}
class Element extends Cell {
position(x:number, y:number):Element;
translate(tx:number, ty?:number):Element;
resize(width:number, height:number):Element;
rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element;
remove(): void;
}
interface IDefaults {
type: string;
}
class Link extends Cell {
defaults():IDefaults;
disconnect():Link;
label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed
remove(): void;
}
interface IOptions {
width: number;
height: number;
gridSize: number;
perpendicularLinks: boolean;
elementView: ElementView;
linkView: LinkView;
}
class Paper extends Backbone.View<Backbone.Model> {
options:IOptions;
setDimensions(width:number, height:number) : void;
scale(sx:number, sy?:number, ox?:number, oy?:number):Paper;
rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already
findView(el:any):CellView;
findViewByModel(modelOrId:any):CellView;
findViewsFromPoint(p:{ x: number; y: number; }):CellView[];
findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[];
fitToContent(opt?:any): void;
}
class ElementView extends CellView {
scale(sx:number, sy:number) : void;
}
class CellView extends Backbone.View<Cell> {
getBBox():{ x: number; y: number; width: number; height: number; };
highlight(el?:any): void;
unhighlight(el?:any): void;
findMagnet(el:any): void;
getSelector(el:any): void;
pointerdblclick(evt:any, x:number, y:number):void;
pointerclick(evt:any, x:number, y:number):void;
pointerdown(evt:any, x:number, y:number):void;
pointermove(evt:any, x:number, y:number):void;
pointerup(evt:any, x:number, y:number):void;
}
class LinkView extends CellView {
getConnectionLength():number;
getPointAtLength(length:number):{ x: number; y: number; };
}
}
module ui {}
module shapes {
module basic {
class Generic extends dia.Element {
}
class Rect extends Generic {
}
class Text extends Generic {
}
class Circle extends Generic {
}
class Image extends Generic {
}
}
}
module util {
function uuid():string;
function guid(obj:any):string;
function mixin(objects:any[]):any;
function supplement(objects:any[]):any;
function deepMixin(objects:any[]):any;
function deepSupplement(objects:any[], defaultIndicator?:any):any;
}
}