Skip to content

Commit

Permalink
using changedTouches instead of touches
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kbaggott committed Feb 2, 2016
1 parent 86ca574 commit 7a180bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dygraph-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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;
};

Expand Down

0 comments on commit 7a180bd

Please sign in to comment.