From: Adrian Iain Lam Date: Tue, 31 Jul 2018 03:55:13 +0000 (+0800) Subject: Merge branch 'PR723' X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;ds=inline;h=91e3b7f8b508d2ec2a03c2a2a0dc6bd32ad5ac6d;p=dygraphs.git Merge branch 'PR723' This merges changes by @kbaggott in danvk/dygraphs PR #723, to allow points to be selected (and thus legends to show up) on touchscreens. --- 91e3b7f8b508d2ec2a03c2a2a0dc6bd32ad5ac6d diff --cc src/dygraph-interaction-model.js index 494b638,411aae4..4fd33d9 --- a/src/dygraph-interaction-model.js +++ b/src/dygraph-interaction-model.js @@@ -472,9 -473,12 +474,12 @@@ DygraphInteraction.startTouch = functio /** * @private */ -Dygraph.Interaction.moveTouch = function(event, g, context) { +DygraphInteraction.moveTouch = function(event, g, context) { // If the tap moves, then it's definitely not part of a double-tap. context.startTimeForDoubleTapMs = null; + + // clear the last touch if it's doing something else + context.lastTouch = null; var i, touches = []; for (i = 0; i < event.touches.length; i++) { diff --cc src/dygraph-utils.js index c0b8f34,63be1d1..54b6b69 --- a/src/dygraph-utils.js +++ b/src/dygraph-utils.js @@@ -198,7 -192,8 +198,8 @@@ export function findPos(obj) * @return {number} * @private */ -Dygraph.pageX = function(e) { +export function pageX(e) { + 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; }; @@@ -210,7 -205,8 +211,8 @@@ * @return {number} * @private */ -Dygraph.pageY = function(e) { +export function pageY(e) { + 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; };