Skip to content

Commit

Permalink
Emit align event for touch users
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Jun 30, 2019
1 parent a804f23 commit 691a2e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/scripts/components/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,18 @@ class GridComponent extends Emitter {
// First align pending chip with column
this.alignPendingChipWithColumn({
column,
// When it's the AI's turn or any async player's turn, automatically
// place the chip after aligning it with the specified column
transitionEnd: () => {
// When it's the AI's turn or any async player's turn, automatically
// place the chip after aligning it with the specified column
if (this.game.currentPlayer.wait) {
this.game.currentPlayer.wait(() => {
this.placePendingChip({ column });
});
} else {
// Otherwise, the current player is the local human player (probably
// on a touch device) and so the alignment event should be emitted
// to the server
this.emitAlignEvent({ column });
}
}
});
Expand Down

0 comments on commit 691a2e7

Please sign in to comment.