inpututil: Bug fix: prevTouchDurations was not updated correctly

This commit is contained in:
Hajime Hoshi 2018-05-11 01:43:31 +09:00
parent f5336ce7bc
commit 5677c8a916

View File

@ -145,14 +145,13 @@ func (i *inputState) update() {
// Touches // Touches
ids := map[int]struct{}{} ids := map[int]struct{}{}
// Reset the previous states first since some gamepad IDs might be already gone. i.prevTouchDurations = map[int]int{}
for id := range i.prevTouchDurations { for id := range i.touchDurations {
i.prevTouchDurations[id] = 0 i.prevTouchDurations[id] = i.touchDurations[id]
} }
for _, id := range ebiten.TouchIDs() { for _, id := range ebiten.TouchIDs() {
ids[id] = struct{}{} ids[id] = struct{}{}
i.prevTouchDurations[id] = i.touchDurations[id]
i.touchDurations[id]++ i.touchDurations[id]++
} }
idsToDelete = []int{} idsToDelete = []int{}