From a401e47314e60b84b77ddd7c265640a5fa3f99bc Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Thu, 15 Jan 2015 16:21:20 -0500 Subject: [PATCH 1/3] add webcola type definition file --- webcola/webcola-tests.ts | 30 ++++++++++++++++++++++++++++++ webcola/webcola.d.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 webcola/webcola-tests.ts create mode 100644 webcola/webcola.d.ts diff --git a/webcola/webcola-tests.ts b/webcola/webcola-tests.ts new file mode 100644 index 0000000000..a306931171 --- /dev/null +++ b/webcola/webcola-tests.ts @@ -0,0 +1,30 @@ +/// +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(); +} diff --git a/webcola/webcola.d.ts b/webcola/webcola.d.ts new file mode 100644 index 0000000000..03de49c0da --- /dev/null +++ b/webcola/webcola.d.ts @@ -0,0 +1,34 @@ +// Type definitions for webcola 3.0.1 +// Project: https://github.com/tgdwyer/WebCola +// Definitions by: Qinfeng Chen +// 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; \ No newline at end of file From fa8b9d2504e29ca74a9d66d0742333081279664e Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Thu, 15 Jan 2015 16:25:11 -0500 Subject: [PATCH 2/3] fix test file name --- webcola/webcola-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webcola/webcola-tests.ts b/webcola/webcola-tests.ts index a306931171..9fc94d4132 100644 --- a/webcola/webcola-tests.ts +++ b/webcola/webcola-tests.ts @@ -1,5 +1,5 @@ /// -module SigmaJsTests { +module WebColaTests { var adaptor = cola.adaptor({ trigger: function() { }, From e1dfb4af5a675c117df09e398c9b09d2cb7c3610 Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Thu, 15 Jan 2015 16:26:26 -0500 Subject: [PATCH 3/3] Add new line at the end of the file --- webcola/webcola.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webcola/webcola.d.ts b/webcola/webcola.d.ts index 03de49c0da..d9ce39c686 100644 --- a/webcola/webcola.d.ts +++ b/webcola/webcola.d.ts @@ -31,4 +31,5 @@ declare module WebCola{ } } -declare var cola: WebCola.Cola; \ No newline at end of file +declare var cola: WebCola.Cola; +