From fc7c15731604a766ec91ea445cedcc9cc3706dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Babi=C4=8D?= Date: Fri, 19 Mar 2021 16:40:15 +0100 Subject: [PATCH] partly extract Triangle to separate component --- README.md | 3 +- src/App.svelte | 76 +++++++++++---------------------------------- src/Triangle.svelte | 70 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 59 deletions(-) create mode 100644 src/Triangle.svelte diff --git a/README.md b/README.md index b1917c8..6bd68fe 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,5 @@ - [x] fix undo missing animation - [x] fix undo when circle picked - [ ] add about page -- [ ] handle U, R and A keypresses +- [ ] fix victory / gameover modal +- [x] handle U, R and A keypresses diff --git a/src/App.svelte b/src/App.svelte index 8649c4d..519c601 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -5,11 +5,7 @@ const adjcs = new Graph() const jumps = new Graph() - const C_MAX_CIRCLES = 21 - const C_POLE = "pole" - const C_HOLE = "hole" - const C_PICK = "pick" - const C_DEST = "dest" + const C_MAX_CIRCLES = 15 const triangular = n => (n <= 1 ? 1 : n + triangular(n - 1)) const leftMost = detph => (detph == 0 ? 0 : triangular(detph)) @@ -55,10 +51,15 @@ + +
+ {#each circles as _, i} + {#key circles[i]} +
dispatch('change', i)} + in:receive={{ key: i }} + out:send={{ key: i }} /> + {/key} + {/each} +