options separation

This commit is contained in:
Klemek
2019-07-12 09:26:30 +02:00
parent 513de5dd97
commit 04d92981a9
2 changed files with 9 additions and 5 deletions
+6 -4
View File
@@ -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';
+3 -1
View File
@@ -4,7 +4,9 @@ const faDiagrams = require('../src/index');
test('test fail placing', () => { test('test fail placing', () => {
const data = { const data = {
options: { options: {
'diagonals': false, 'placing': {
'diagonals': false,
}
}, },
nodes: [ nodes: [
{name: '1', icon: ''}, {name: '1', icon: ''},