From 6552c64888dbc8741b28b09ea33f9c8883497661 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 3 Mar 2022 20:57:50 +1100
Subject: Add basic sweep-to-side layout

---
 src/App.vue | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index 5c7c293..b1efd4b 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,15 @@
 <script>
 import tol from './tol.json';
+function addTileCounts(tree){
+	if (tree.children && tree.children.length > 0){
+		tree.children.forEach(addTileCounts)
+		tree.tileCount = tree.children.reduce((acc, val) => acc + val.tileCount, 0);
+	} else {
+		tree.tileCount = 1;
+	}
+}
+addTileCounts(tol);
+
 import TileTree from "./components/TileTree.vue";
 export default {
 	data() {
-- 
cgit v1.2.3

