From 9919e083f064b808d8d2c7640afd0f151f384efe Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Sat, 21 Apr 2018 14:02:25 +0200 Subject: [PATCH] Fix 2048 on desktop browsers One thing I found out while working on #908 this is that the 2048 game demo does not work on browsers since it listens for touch events only. This can be solved by listening to both mouse and touch events. --- website/storybook/3-demos/Game2048/Game2048.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/website/storybook/3-demos/Game2048/Game2048.js b/website/storybook/3-demos/Game2048/Game2048.js index 50c934b20..ba15c9180 100644 --- a/website/storybook/3-demos/Game2048/Game2048.js +++ b/website/storybook/3-demos/Game2048/Game2048.js @@ -184,7 +184,7 @@ class Game2048 extends React.Component { this.setState({ board: new GameBoard() }); }; - _handleTouchStart = (event: Object) => { + _handleStart = (event: Object) => { if (this.state.board.hasWon()) { return; } @@ -193,7 +193,7 @@ class Game2048 extends React.Component { this.startY = event.nativeEvent.pageY; }; - _handleTouchEnd = (event: Object) => { + _handleEnd = (event: Object) => { if (this.state.board.hasWon()) { return; } @@ -220,8 +220,10 @@ class Game2048 extends React.Component { return ( {tiles}