Skip to content

Commit

Permalink
Undo check for touchPreviousData
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmorris committed Mar 31, 2023
1 parent 824fc95 commit d205ac8
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lander/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,13 @@ export const makeControls = (state, lander, audioManager) => {
touchPreviousData = touch;
}
});
const previousTouchZone = getTouchZone(touchPreviousData.clientX);
const currentTouchZone = getTouchZone(e.changedTouches[index].clientX);

if (touchPreviousData) {
const previousTouchZone = getTouchZone(touchPreviousData.clientX);
const currentTouchZone = getTouchZone(e.changedTouches[index].clientX);

if (previousTouchZone !== currentTouchZone) {
deactivateTouchZone(previousTouchZone);
activateTouchZone(currentTouchZone);
allActiveTouches.delete(touchPreviousData);
allActiveTouches.add(e.changedTouches[index]);
}
} else {
activateTouchZone(getTouchZone(e.changedTouches[index].clientX));
if (previousTouchZone !== currentTouchZone) {
deactivateTouchZone(previousTouchZone);
activateTouchZone(currentTouchZone);
allActiveTouches.delete(touchPreviousData);
allActiveTouches.add(e.changedTouches[index]);
}
}
Expand Down

0 comments on commit d205ac8

Please sign in to comment.