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 ## TODO
- [x] add gray shades - [x] add gray shades
- [ ] update icons - [x] update icons
- [ ] manage UI buttons - [x] manage UI buttons
- [ ] fix undo missing animation - [x] fix undo missing animation
- [ ] fix undo when circle picked - [x] fix undo when circle picked
- [ ] add about page - [ ] add about page
- [ ] handle U, R and A keypresses

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

Loading…
Cancel
Save