From: Kyle Baggott Date: Tue, 2 Feb 2016 10:55:20 +0000 (+0000) Subject: using changedTouches instead of touches X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=7a180bd1f113816214c5ed5d90b4a9314658c940;p=dygraphs.git 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. --- 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; };