options separation
This commit is contained in:
+4
-2
@@ -30,9 +30,11 @@ const merge = (ref, src) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_OPTIONS = {
|
const DEFAULT_OPTIONS = {
|
||||||
'expand': 'h',
|
'placing': {
|
||||||
'max-link-length': 2,
|
'max-link-length': 2,
|
||||||
'diagonals': true,
|
'diagonals': true,
|
||||||
|
},
|
||||||
|
'rendering': {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ const self = {
|
|||||||
links.filter(l => !nodes[l.to]).forEach(l => console.warn(`unknown destination node "${l.to}"`));
|
links.filter(l => !nodes[l.to]).forEach(l => console.warn(`unknown destination node "${l.to}"`));
|
||||||
links = links.filter(l => nodes[l.from] && nodes[l.to]);
|
links = links.filter(l => nodes[l.from] && nodes[l.to]);
|
||||||
|
|
||||||
nodes = placing(options).compute(nodes, links);
|
nodes = placing(options['placing']).compute(nodes, links);
|
||||||
|
|
||||||
if (!nodes)
|
if (!nodes)
|
||||||
throw 'Failed to place nodes';
|
throw 'Failed to place nodes';
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ const faDiagrams = require('../src/index');
|
|||||||
test('test fail placing', () => {
|
test('test fail placing', () => {
|
||||||
const data = {
|
const data = {
|
||||||
options: {
|
options: {
|
||||||
|
'placing': {
|
||||||
'diagonals': false,
|
'diagonals': false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
nodes: [
|
nodes: [
|
||||||
{name: '1', icon: ''},
|
{name: '1', icon: ''},
|
||||||
|
|||||||
Reference in New Issue
Block a user