@@ -16,70 +16,6 @@ import * as _ from 'lodash';
1616 * High-level API managing the flow.
1717 */
1818export class Surface implements ISurface {
19- graph : IGraph ;
20- model : IFlowModel ;
21- graphComponent : GraphComponent ;
22-
23- constructor ( ) {
24- this . model = new FlowModel ( ) ;
25- this . init ( ) ;
26- }
27-
28- init ( ) {
29- this . setLicense ( ) ;
30- this . createComponent ( ) ;
31- this . setStyle ( ) ;
32- this . defineBridges ( ) ;
33- this . createInteractions ( ) ;
34- }
35-
36- setLicense ( ) {
37-
38- License . value = {
39- 'company' : 'The Orbifold b.v.b.a.' ,
40- 'date' : '10/22/2019' ,
41- 'distribution' : true ,
42- 'domains' : [
43- '*'
44- ] ,
45- 'fileSystemAllowed' : true ,
46- 'licensefileversion' : '1.1' ,
47- 'localhost' : true ,
48- 'oobAllowed' : true ,
49- 'package' : 'complete' ,
50- 'product' : 'yFiles for HTML' ,
51- 'projectname' : 'yWorks Consulting' ,
52- 'subscription' : '12/31/2020' ,
53- 'type' : 'project' ,
54- 'version' : '2.2' ,
55- 'key' : 'd9568c2bdf4ebd16cf3d80a0edc8fe155ca5a38c'
56- } ;
57- }
58-
59- createComponent ( ) {
60- this . graphComponent = new GraphComponent ( '#graphComponent' ) ;
61- this . graph = this . graphComponent . graph ;
62-
63- }
64-
65- layout ( ) {
66- const executor = new LayoutExecutor ( {
67- graphComponent : this . graphComponent ,
68- layout : new HierarchicLayout ( {
69- layoutOrientation : 'left-to-right' ,
70- gridSpacing : 0
71- } ) ,
72- animateViewport : true ,
73- easedAnimation : true ,
74- duration : '0.5s' ,
75- fixPorts : true ,
76- } ) ;
77-
78- executor . start ( ) . then ( ( ) => {
79- this . graphComponent . fitContent ( ) ;
80- this . graphComponent . zoom = 3 ;
81- } ) ;
82- }
8319
8420 private createInteractions ( ) {
8521 const mode = new GraphEditorInputMode ( ) ;
@@ -211,6 +147,70 @@ export class Surface implements ISurface {
211147 }
212148 }
213149 }
150+ graph : IGraph ;
151+ model : IFlowModel ;
152+ graphComponent : GraphComponent ;
153+
154+ constructor ( ) {
155+ this . model = new FlowModel ( ) ;
156+ this . init ( ) ;
157+ }
158+
159+ init ( ) {
160+ this . setLicense ( ) ;
161+ this . createComponent ( ) ;
162+ this . setStyle ( ) ;
163+ this . defineBridges ( ) ;
164+ this . createInteractions ( ) ;
165+ }
166+
167+ setLicense ( ) {
168+
169+ License . value = {
170+ 'company' : 'The Orbifold b.v.b.a.' ,
171+ 'date' : '10/22/2019' ,
172+ 'distribution' : true ,
173+ 'domains' : [
174+ '*'
175+ ] ,
176+ 'fileSystemAllowed' : true ,
177+ 'licensefileversion' : '1.1' ,
178+ 'localhost' : true ,
179+ 'oobAllowed' : true ,
180+ 'package' : 'complete' ,
181+ 'product' : 'yFiles for HTML' ,
182+ 'projectname' : 'yWorks Consulting' ,
183+ 'subscription' : '12/31/2020' ,
184+ 'type' : 'project' ,
185+ 'version' : '2.2' ,
186+ 'key' : 'd9568c2bdf4ebd16cf3d80a0edc8fe155ca5a38c'
187+ } ;
188+ }
189+
190+ createComponent ( ) {
191+ this . graphComponent = new GraphComponent ( '#graphComponent' ) ;
192+ this . graph = this . graphComponent . graph ;
193+
194+ }
195+
196+ layout ( ) {
197+ const executor = new LayoutExecutor ( {
198+ graphComponent : this . graphComponent ,
199+ layout : new HierarchicLayout ( {
200+ layoutOrientation : 'left-to-right' ,
201+ gridSpacing : 0
202+ } ) ,
203+ animateViewport : true ,
204+ easedAnimation : true ,
205+ duration : '0.5s' ,
206+ fixPorts : true ,
207+ } ) ;
208+
209+ executor . start ( ) . then ( ( ) => {
210+ this . graphComponent . fitContent ( ) ;
211+ this . graphComponent . zoom = 3 ;
212+ } ) ;
213+ }
214214
215215 connect ( source : IPort , target : IPort ) : IEdge {
216216 // note that the `graph.addEdgeCreatedListener` takes are of the rest
0 commit comments