This merges changes by @kbaggott in danvk/dygraphs PR #723,
to allow points to be selected (and thus legends to show up)
on touchscreens.
/**
* @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++) {
* @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;
};
* @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;
};