Skip to content

Commit 5a455af

Browse files
authored
expose the adjust vertices config option (#21)
1 parent 2fdf717 commit 5a455af

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.storybook/stories/advanced/directed-graph.stories.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ var GRAPH_DATA = {
106106
from: 1235,
107107
to: 1236
108108
},
109+
'1236-1235': {
110+
edgeType: GRAPH_ENUM.EDGE.EDGE,
111+
from: 1236,
112+
to: 1235
113+
}
109114
}
110115
};
111116

@@ -129,6 +134,7 @@ export const DirectedGraphExample = (args) => {
129134
passiveUIEvents: false,
130135
includeFonts: true,
131136
incrementNodeNames: true,
137+
adjustVertices: true,
132138
defaultStyles: {
133139
background: {
134140
color: '#20292B',

src/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export var DEFAULT_CONFIG = {
2020
edgeHoverEffect: true,
2121
includeFonts: true,
2222
useGlobalPCUI: false,
23+
adjustVertices: false,
2324
defaultStyles: {
2425
initialScale: 1,
2526
initialPosition: {

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Graph extends Element {
2525
* @param {boolean} options.edgeHoverEffect - Whether the graph should show an edge highlight effect when the mouse is hovering over edges. Optional. Defaults to true.
2626
* @param {boolean} options.includeFonts - If true the graph will include a default font style. Defaults to true.
2727
* @param {object} options.defaultStyles - Used to override the graph's default styling. Check ./constants.js for a full list of style properties.
28+
* @param {object} options.adjustVertices - If true, multiple edges conntected between two nodes will be spaced apart.
2829
*/
2930
constructor(schema, options = {}) {
3031
super(options.dom ? options.dom : document.createElement('div'), {});
@@ -42,7 +43,8 @@ class Graph extends Element {
4243
restrictTranslate: options.restrictTranslate,
4344
edgeHoverEffect: options.edgeHoverEffect,
4445
includeFonts: options.includeFonts,
45-
useGlobalPCUI: options.useGlobalPCUI
46+
useGlobalPCUI: options.useGlobalPCUI,
47+
adjustVertices: options.adjustVertices
4648
};
4749
if (options.defaultStyles) {
4850
if (options.defaultStyles.background) {

0 commit comments

Comments
 (0)