From a681949995e5680b93c71bdb1faea318c832f979 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 9 Jan 2016 22:47:28 -0800 Subject: [PATCH] Fix mobile touches can be empty. Use changedTouches as backup --- common/app/routes/Hikes/flux/Actions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/app/routes/Hikes/flux/Actions.js b/common/app/routes/Hikes/flux/Actions.js index f93f5932fb4..dcde5c25957 100644 --- a/common/app/routes/Hikes/flux/Actions.js +++ b/common/app/routes/Hikes/flux/Actions.js @@ -38,12 +38,13 @@ function findNextHike(hikes, id) { function getMouse(e, [dx, dy]) { - let { pageX, pageY, touches } = e; + let { pageX, pageY, touches, changedTouches } = e; - if (touches) { + // touches can be empty on touchend + if (touches || changedTouches) { e.preventDefault(); // these re-assigns the values of pageX, pageY from touches - ({ pageX, pageY } = touches[0]); + ({ pageX, pageY } = touches[0] || changedTouches[0]); } return [pageX - dx, pageY - dy];