1- [ Shader Graph API ] ( ../README.md ) / Graph
1+ [ Home ] ( ../README.md ) / Graph
22
33# Class: Graph
44
@@ -53,43 +53,43 @@ Creates a new Graph.
5353
5454| Name | Type | Description |
5555| :------ | :------ | :------ |
56- | ` schema ` | ` any ` | The graph schema. |
56+ | ` schema ` | ` object ` | The graph schema. |
5757| ` options? ` | ` Object ` | The graph configuration. Optional. |
58- | ` options.initialData ` | ` any ` | The graph data to initialize the graph with. |
58+ | ` options.initialData ` | ` object ` | The graph data to initialize the graph with. |
5959| ` options.dom ` | ` HTMLElement ` | If supplied, the graph will be attached to this element. |
60- | ` options.contextMenuItems ` | ` any ` [ ] | The context menu items to add to the graph. |
60+ | ` options.contextMenuItems ` | ` object ` [ ] | The context menu items to add to the graph. |
6161| ` options.readOnly ` | ` boolean ` | Whether the graph is read only. Optional. Defaults to false. |
6262| ` options.passiveUIEvents ` | ` boolean ` | If true, the graph will not update its data and view upon user interaction. Instead, these interactions can be handled explicitly by listening to fired events. Optional. Defaults to false. |
6363| ` options.incrementNodeNames ` | ` boolean ` | Whether the graph should increment the node name when a node with the same name already exists. Optional. Defaults to false. |
6464| ` options.restrictTranslate ` | ` boolean ` | Whether the graph should restrict the translate graph operation to the graph area. Optional. Defaults to false. |
6565| ` options.edgeHoverEffect ` | ` boolean ` | Whether the graph should show an edge highlight effect when the mouse is hovering over edges. Optional. Defaults to true. |
66- | ` options.defaultStyles ` | ` any ` | Used to override the graph's default styling. Check ./constants.js for a full list of style properties. |
67- | ` options.adjustVertices ` | ` any ` | If true, multiple edges connected between two nodes will be spaced apart. |
66+ | ` options.defaultStyles ` | ` object ` | Used to override the graph's default styling. Check ./constants.js for a full list of style properties. |
67+ | ` options.adjustVertices ` | ` object ` | If true, multiple edges connected between two nodes will be spaced apart. |
6868
6969#### Overrides
7070
7171Element.constructor
7272
7373#### Defined in
7474
75- [ index.js:36] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L36 )
75+ [ index.js:36] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L36 )
7676
7777## Accessors
7878
7979### data
8080
81- • ` get ` ** data** (): ` any `
81+ • ` get ` ** data** (): ` object `
8282
8383The current graph data. Contains an object with any nodes and edges present in the graph.
8484This can be passed into the graph constructor to reload the current graph.
8585
8686#### Returns
8787
88- ` any `
88+ ` object `
8989
9090#### Defined in
9191
92- [ index.js:94 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L94 )
92+ [ index.js:93 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L93 )
9393
9494## Methods
9595
@@ -104,9 +104,13 @@ with the graph.
104104
105105` void `
106106
107+ #### Overrides
108+
109+ Element.destroy
110+
107111#### Defined in
108112
109- [ index.js:102 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L102 )
113+ [ index.js:101 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L101 )
110114
111115___
112116
@@ -120,15 +124,15 @@ Select a node in the current graph.
120124
121125| Name | Type | Description |
122126| :------ | :------ | :------ |
123- | ` node ` | ` any ` | The node to select |
127+ | ` node ` | ` object ` | The node to select |
124128
125129#### Returns
126130
127131` void `
128132
129133#### Defined in
130134
131- [ index.js:215 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L215 )
135+ [ index.js:214 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L214 )
132136
133137___
134138
@@ -142,7 +146,7 @@ Select an edge in the current graph.
142146
143147| Name | Type | Description |
144148| :------ | :------ | :------ |
145- | ` edge ` | ` any ` | The edge to select |
149+ | ` edge ` | ` object ` | The edge to select |
146150| ` edgeId ` | ` number ` | The edge id of the edge to select |
147151
148152#### Returns
@@ -151,7 +155,7 @@ Select an edge in the current graph.
151155
152156#### Defined in
153157
154- [ index.js:227 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L227 )
158+ [ index.js:226 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L226 )
155159
156160___
157161
@@ -167,7 +171,7 @@ Deselect the currently selected item in the graph.
167171
168172#### Defined in
169173
170- [ index.js:236 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L236 )
174+ [ index.js:235 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L235 )
171175
172176___
173177
@@ -181,7 +185,7 @@ Add an edge to the graph.
181185
182186| Name | Type | Description |
183187| :------ | :------ | :------ |
184- | ` edge ` | ` any ` | The edge to add. |
188+ | ` edge ` | ` object ` | The edge to add. |
185189| ` edgeId ` | ` number ` | The edge id for the new edge. |
186190
187191#### Returns
@@ -190,7 +194,7 @@ Add an edge to the graph.
190194
191195#### Defined in
192196
193- [ index.js:254 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L254 )
197+ [ index.js:253 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L253 )
194198
195199___
196200
@@ -204,15 +208,15 @@ Add a node to the graph.
204208
205209| Name | Type | Description |
206210| :------ | :------ | :------ |
207- | ` node ` | ` any ` | The node to add. |
211+ | ` node ` | ` object ` | The node to add. |
208212
209213#### Returns
210214
211215` void `
212216
213217#### Defined in
214218
215- [ index.js:386 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L386 )
219+ [ index.js:385 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L385 )
216220
217221___
218222
@@ -227,15 +231,15 @@ Update the position of a node.
227231| Name | Type | Description |
228232| :------ | :------ | :------ |
229233| ` nodeId ` | ` number ` | The node to add. |
230- | ` pos ` | ` any ` | The new position, given as an object containing x and y properties. |
234+ | ` pos ` | ` object ` | The new position, given as an object containing x and y properties. |
231235
232236#### Returns
233237
234238` void `
235239
236240#### Defined in
237241
238- [ index.js:425 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L425 )
242+ [ index.js:424 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L424 )
239243
240244___
241245
@@ -251,15 +255,15 @@ Update the value of an attribute of a node.
251255| :------ | :------ | :------ |
252256| ` nodeId ` | ` number ` | The node to update. |
253257| ` attributeName ` | ` string ` | The name of the attribute to update. |
254- | ` value ` | ` any ` | The new value for the attribute. |
258+ | ` value ` | ` object ` | The new value for the attribute. |
255259
256260#### Returns
257261
258262` void `
259263
260264#### Defined in
261265
262- [ index.js:439 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L439 )
266+ [ index.js:438 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L438 )
263267
264268___
265269
@@ -283,7 +287,7 @@ Set the error state of a node attribute.
283287
284288#### Defined in
285289
286- [ index.js:452 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L452 )
290+ [ index.js:451 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L451 )
287291
288292___
289293
@@ -306,7 +310,7 @@ Update the type of a node.
306310
307311#### Defined in
308312
309- [ index.js:463 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L463 )
313+ [ index.js:462 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L462 )
310314
311315___
312316
@@ -328,7 +332,7 @@ Delete a node from the graph.
328332
329333#### Defined in
330334
331- [ index.js:492 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L492 )
335+ [ index.js:491 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L491 )
332336
333337___
334338
@@ -350,7 +354,7 @@ Delete an edge from the graph.
350354
351355#### Defined in
352356
353- [ index.js:507 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L507 )
357+ [ index.js:506 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L506 )
354358
355359___
356360
@@ -373,26 +377,26 @@ Set the center of the viewport to the given position.
373377
374378#### Defined in
375379
376- [ index.js:538 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L538 )
380+ [ index.js:537 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L537 )
377381
378382___
379383
380384### getGraphPosition
381385
382- ▸ ** getGraphPosition** (): ` any `
386+ ▸ ** getGraphPosition** (): ` object `
383387
384388Get the current center position of the viewport in the graph.
385389
386390#### Returns
387391
388- ` any `
392+ ` object `
389393
390394The current center position of the viewport in the graph as an object
391395containing x and y.
392396
393397#### Defined in
394398
395- [ index.js:548 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L548 )
399+ [ index.js:547 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L547 )
396400
397401___
398402
@@ -414,7 +418,7 @@ Set the scale of the graph.
414418
415419#### Defined in
416420
417- [ index.js:557 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L557 )
421+ [ index.js:556 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L556 )
418422
419423___
420424
@@ -432,32 +436,32 @@ The current scale of the graph.
432436
433437#### Defined in
434438
435- [ index.js:569 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L569 )
439+ [ index.js:568 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L568 )
436440
437441___
438442
439443### getWindowToGraphPosition
440444
441- ▸ ** getWindowToGraphPosition** (` pos ` ): ` any `
445+ ▸ ** getWindowToGraphPosition** (` pos ` ): ` object `
442446
443447Convert a position in window space to a position in graph space.
444448
445449#### Parameters
446450
447451| Name | Type | Description |
448452| :------ | :------ | :------ |
449- | ` pos ` | ` any ` | A position in the window, as an object containing x and y. |
453+ | ` pos ` | ` object ` | A position in the window, as an object containing x and y. |
450454
451455#### Returns
452456
453- ` any `
457+ ` object `
454458
455459The position in the graph based on the given window position, as an object
456460containing x and y.
457461
458462#### Defined in
459463
460- [ index.js:580 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L580 )
464+ [ index.js:579 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L579 )
461465
462466___
463467
@@ -478,6 +482,10 @@ Add an event listener to the graph.
478482
479483` void `
480484
485+ #### Overrides
486+
487+ Element.on
488+
481489#### Defined in
482490
483- [ index.js:590 ] ( https://github.com/playcanvas/pcui-graph/blob/9e2f5c2 /src/index.js#L590 )
491+ [ index.js:589 ] ( https://github.com/playcanvas/pcui-graph/blob/6c082be /src/index.js#L589 )
0 commit comments