projects
/
dygraphs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5d2acf2
)
Call zoomCallback from touch interactions (issue 395)
author
Dan Vanderkam
<danvdk@gmail.com>
Fri, 8 Feb 2013 22:58:21 +0000
(17:58 -0500)
committer
Dan Vanderkam
<danvdk@gmail.com>
Fri, 8 Feb 2013 22:58:21 +0000
(17:58 -0500)
dygraph-interaction-model.js
patch
|
blob
|
blame
|
history
diff --git
a/dygraph-interaction-model.js
b/dygraph-interaction-model.js
index
9654f28
..
9ad636a
100644
(file)
--- a/
dygraph-interaction-model.js
+++ b/
dygraph-interaction-model.js
@@
-471,11
+471,13
@@
Dygraph.Interaction.moveTouch = function(event, g, context) {
xScale = Math.min(8, Math.max(0.125, xScale));
yScale = Math.min(8, Math.max(0.125, yScale));
xScale = Math.min(8, Math.max(0.125, xScale));
yScale = Math.min(8, Math.max(0.125, yScale));
+ var didZoom = false;
if (context.touchDirections.x) {
g.dateWindow_ = [
c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale,
c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale
];
if (context.touchDirections.x) {
g.dateWindow_ = [
c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale,
c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale
];
+ didZoom = true;
}
if (context.touchDirections.y) {
}
if (context.touchDirections.y) {
@@
-489,11
+491,18
@@
Dygraph.Interaction.moveTouch = function(event, g, context) {
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
];
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
];
+ didZoom = true;
}
}
}
g.drawGraph_(false);
}
}
}
g.drawGraph_(false);
+
+ // We only call zoomCallback on zooms, not pans, to mirror desktop behavior.
+ if (didZoom && touches.length > 1 && g.attr_('zoomCallback')) {
+ var viewWindow = g.xAxisRange();
+ g.attr_("zoomCallback")(viewWindow[0], viewWindow[1], g.yAxisRanges());
+ }
};
/**
};
/**