From 7a180bd1f113816214c5ed5d90b4a9314658c940 Mon Sep 17 00:00:00 2001 From: Kyle Baggott Date: Tue, 2 Feb 2016 10:55:20 +0000 Subject: [PATCH] using changedTouches instead of touches In testing on different devices it seems changedTouches is better supported cross platform, using this instead of the the touches object. Roughly tested on iOS and Android. --- src/dygraph-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dygraph-utils.js b/src/dygraph-utils.js index 682c441..63be1d1 100644 --- a/src/dygraph-utils.js +++ b/src/dygraph-utils.js @@ -193,7 +193,7 @@ Dygraph.findPos = function(obj) { * @private */ Dygraph.pageX = function(e) { - if (e.isTouchOver) return (!e.touches[0] || e.touches[0].pageX < 0) ? 0 : e.touches[0].pageX; + if (e.isTouchOver) return (!e.changedTouches[0] || e.changedTouches[0].pageX < 0) ? 0 : e.changedTouches[0].pageX; return (!e.pageX || e.pageX < 0) ? 0 : e.pageX; }; @@ -206,7 +206,7 @@ Dygraph.pageX = function(e) { * @private */ Dygraph.pageY = function(e) { - if (e.isTouchOver) return (!e.touches[0] || e.touches[0].pageY < 0) ? 0 : e.touches[0].pageY; + if (e.isTouchOver) return (!e.changedTouches[0] || e.changedTouches[0].pageY < 0) ? 0 : e.changedTouches[0].pageY; return (!e.pageY || e.pageY < 0) ? 0 : e.pageY; }; -- 2.7.4