context.initialLeftmostDate = utils.log10(xRange[0]);
context.dateRange = utils.log10(xRange[1]) - utils.log10(xRange[0]);
} else {
- context.initialLeftmostDate = xRange[0];
+ context.initialLeftmostDate = xRange[0];
context.dateRange = xRange[1] - xRange[0];
}
context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1);
}
// Record the range of each y-axis at the start of the drag.
- // If any axis has a valueRange or valueWindow, then we want a 2D pan.
+ // If any axis has a valueRange, then we want a 2D pan.
// We can't store data directly in g.axes_, because it does not belong to us
// and could change out from under us during a pan (say if there's a data
// update).
context.axes.push(axis_data);
// While calculating axes, set 2dpan.
- if (axis.valueWindow || axis.valueRange) context.is2DPan = true;
+ if (axis.valueRange) context.is2DPan = true;
}
};
g.dateWindow_ = [ Math.pow(utils.LOG_SCALE, minDate),
Math.pow(utils.LOG_SCALE, maxDate) ];
} else {
- g.dateWindow_ = [minDate, maxDate];
+ g.dateWindow_ = [minDate, maxDate];
}
// y-axis scaling is automatic unless this is a full 2D pan.
}
}
if (g.attributes_.getForAxis("logscale", i)) {
- axis.valueWindow = [ Math.pow(utils.LOG_SCALE, minValue),
- Math.pow(utils.LOG_SCALE, maxValue) ];
+ axis.valueRange = [ Math.pow(utils.LOG_SCALE, minValue),
+ Math.pow(utils.LOG_SCALE, maxValue) ];
} else {
- axis.valueWindow = [ minValue, maxValue ];
+ axis.valueRange = [ minValue, maxValue ];
}
}
}
context.initialTouches = touches;
if (touches.length == 1) {
- // This is just a swipe.
+ // This is possbily a touchOVER, save the last touch to check
+ context.lastTouch = event;
+ // or This is just a swipe.
context.initialPinchCenter = touches[0];
context.touchDirections = { x: true, y: true };
} else if (touches.length >= 2) {
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++) {
];
didZoom = true;
}
-
+
if (context.touchDirections.y) {
for (i = 0; i < 1 /*g.axes_.length*/; i++) {
var axis = g.axes_[i];
if (logscale) {
// TODO(danvk): implement
} else {
- axis.valueWindow = [
+ axis.valueRange = [
c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale,
c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale
];
context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) {
g.resetZoom();
} else {
+
+ if (context.lastTouch !== null){
+ // no double-tap, pan or pinch so it's a touchOVER
+ event.isTouchOver = true;
+ g.mouseMove_(event);
+ }
+
context.startTimeForDoubleTapMs = now;
context.doubleTapX = t.screenX;
context.doubleTapY = t.screenY;
// Give plugins a chance to grab this event.
var e = {
canvasx: context.dragEndX,
- canvasy: context.dragEndY
+ canvasy: context.dragEndY,
+ cancelable: true,
};
if (g.cascadeEvents_('dblclick', e)) {
return;