diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-05 00:58:23 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-05 09:21:31 +1100 |
| commit | 4a42e773992e978b877e10d3d3ece7672fffb36d (patch) | |
| tree | 6812b8eda149028141050f2c3472fb79d142f64e /src/App.vue | |
| parent | dfdfa7f2b466eeae566a9890dcc34cefdf368a39 (diff) | |
Allow starting from root tile, make App.vue tileCount-independent
Diffstat (limited to 'src/App.vue')
| -rw-r--r-- | src/App.vue | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/App.vue b/src/App.vue index 5e7f904..08b442c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,7 @@ import TileTree from "./components/TileTree.vue"; export default { data() { return { - tree: this.genTreeForTol(tol, 1), //allow for zero-level? + tree: {tolNode: tol, children: []}, width: document.documentElement.clientWidth, height: document.documentElement.clientHeight, } @@ -23,18 +23,6 @@ export default { this.width = document.documentElement.clientWidth; this.height = document.documentElement.clientHeight; }, - genTreeForTol(tol, lvl){ - if (lvl == 0){ - return {tolNode: tol, children: [], tileCount: 1}; - } else { - let childTrees = tol.children.map(e => this.genTreeForTol(e, lvl-1)); - return { - tolNode: tol, - children: childTrees, - tileCount: (childTrees.length == 0) ? 1 : childTrees.map(e => e.tileCount).reduce((x,y) => x+y) - }; - } - } }, created(){ window.addEventListener('resize', this.onResize); @@ -50,7 +38,7 @@ export default { <template> <div class="h-[100vh]"> - <tile-tree :tree="tree" :x="0" :y="0" :width="width" :height="height" isRoot></tile-tree> + <tile-tree :treeIn="tree" :x="0" :y="0" :width="width" :height="height" isRoot></tile-tree> </div> </template> |
