From dfdfa7f2b466eeae566a9890dcc34cefdf368a39 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 4 Mar 2022 23:35:59 +1100 Subject: Increase basicRectsLayout() general-usability --- src/components/TileTree.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index 3de358b..4c3b34d 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -22,6 +22,7 @@ export default { let hOffset = (this.isRoot ? 0 : this.HEADER_SZ); let x = 0, y = hOffset, w = this.width, h = this.height - hOffset; //return this.basicSquaresLayout(this.tree.children, 0, hOffset, this.width, this.height - hOffset); + //return this.basicRectsLayout(this.tree.children, 0, hOffset, this.width, this.height - hOffset); return this.sweepToSideLayout(this.tree.children, 0, hOffset, this.width, this.height - hOffset); } }, @@ -77,9 +78,12 @@ export default { let score = 0; for (let r = 0; r < nr; r++){ for (let c = 0; c < nc; c++){ - score -= Math.abs(grid[r][c] - (rowProp[r] * colProp[c])); + if (grid[r][c] > 0){ + score -= Math.abs(grid[r][c] - (rowProp[r] * colProp[c])); + } } } + //also score for w/h occupation? if (score > bestScore){ bestScore = score; numCols = nc; @@ -177,7 +181,7 @@ export default { class="transition-all duration-300 ease-out border border-stone-900">