From 3e570c1861caee6c227752148f7b980169696ba2 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 16 Aug 2019 19:11:22 +0000 Subject: [PATCH] Fix layout with just nodes --- Layout.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Layout.js b/Layout.js index bd28d57..6691ceb 100644 --- a/Layout.js +++ b/Layout.js @@ -173,6 +173,12 @@ class Layout { fixOrigin() { let min = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]; let max = [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY]; + for (let node of this.nodes_) { + for (let i of [0, 1]) { + min[i] = Math.min(min[i], node.pos[i]); + max[i] = Math.max(max[i], node.pos[i]); + } + } for (let group of this.groups_) { let [groupMin, groupMax] = group.getMinMax(); for (let i of [0, 1]) {