fix undo button

master
Peter Babič 3 years ago
parent 78ea622b02
commit 3c8d21554d
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 9
      README.md
  2. 8
      src/App.svelte

@ -3,8 +3,9 @@
## TODO
- [x] add gray shades
- [ ] update icons
- [ ] manage UI buttons
- [ ] fix undo missing animation
- [ ] fix undo when circle picked
- [x] update icons
- [x] manage UI buttons
- [x] fix undo missing animation
- [x] fix undo when circle picked
- [ ] add about page
- [ ] handle U, R and A keypresses

@ -122,15 +122,16 @@
const [src, dest, color] = moveStack.pop()
circleColors[src] = color
jumpReverse(circles, dest, src)
clearPick()
clearDests()
victory = false
gameover = false
setTimeout(() => (circleColors = circleColors), duration)
}
}
const getColor = i => colors[i % colors.length]
const getDestColor = _ => circleColors[circles.indexOf(C_PICK)]
$: getCircleColor = i => {
if (circles[i] == C_HOLE) return `bg-gray`
if (circles[i] == C_POLE) return `bg-${circleColors[i]}`
@ -152,6 +153,9 @@
return common
}
const clearPick = () =>
(circles = circles.map(c => (c == C_PICK ? C_POLE : c)))
const clearDests = () =>
(circles = circles.map(c => (c == C_DEST ? C_HOLE : c)))

Loading…
Cancel
Save