add webcola type definition file

This commit is contained in:
Qinfeng Chen
2015-01-15 16:21:20 -05:00
parent 2cc4331067
commit a401e47314
2 changed files with 64 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="webcola.d.ts"/>
module SigmaJsTests {
var adaptor = cola.adaptor({
trigger: function() {
},
kick: function() {
},
on: function() {
},
drag: function() {
}
});
adaptor
.size([100, 100])
.avoidOverlaps(true)
.nodes({})
.links({})
.handleDisconnected(true)
.convergenceThreshold(0.001)
.constraints({})
.linkDistance(100)
.flowLayout('y', 0);
adaptor.start(1, 2, 3);
adaptor.dragstart({});
adaptor.dragend({});
adaptor.stop();
adaptor.resume();
}
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for webcola 3.0.1
// Project: https://github.com/tgdwyer/WebCola
// Definitions by: Qinfeng Chen <https://github.com/qinfchen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module WebCola{
interface Adaptor {
avoidOverlaps(avodOverLaps: boolean): Adaptor;
constraints(constraints: any): Adaptor;
convergenceThreshold(convergenceThreshold: number): Adaptor;
dragend(node: { [index: number]: any }): void;
dragstart(node: { [index: number]: any }): void;
flowLayout(axis: string, minSeparation: number): Adaptor;
handleDisconnected(handleDisconnected: boolean): Adaptor;
links(links: any): Adaptor;
linkDistance(linkLength: number): Adaptor;
nodes(nodes: any): Adaptor;
resume(): void;
size(dimension: number[]): Adaptor;
start(
initialUnconstrainedIterations: number,
initialUserConstraintIterations: number,
initialAllConstraintsIterations: number
): void;
stop(): void;
}
interface Cola {
adaptor(options: { [index:number]: any }): Adaptor;
start(): void;
stop(): void;
}
}
declare var cola: WebCola.Cola;