From 04d92981a9566d7151fc6766dbaff26e92dc319b Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 12 Jul 2019 09:26:30 +0200 Subject: [PATCH] options separation --- src/index.js | 10 ++++++---- test/index.test.js | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 9bb0d45..21b8b8e 100644 --- a/src/index.js +++ b/src/index.js @@ -30,9 +30,11 @@ const merge = (ref, src) => { }; const DEFAULT_OPTIONS = { - 'expand': 'h', - 'max-link-length': 2, - 'diagonals': true, + 'placing': { + 'max-link-length': 2, + '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 = links.filter(l => nodes[l.from] && nodes[l.to]); - nodes = placing(options).compute(nodes, links); + nodes = placing(options['placing']).compute(nodes, links); if (!nodes) throw 'Failed to place nodes'; diff --git a/test/index.test.js b/test/index.test.js index dcd7443..89ee6d7 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -4,7 +4,9 @@ const faDiagrams = require('../src/index'); test('test fail placing', () => { const data = { options: { - 'diagonals': false, + 'placing': { + 'diagonals': false, + } }, nodes: [ {name: '1', icon: ''},