Permalink
Browse files

Fix Issue 279: Strange animations when zooming animations are enabled…

… and double click zooming
  • Loading branch information...
danvk committed Feb 26, 2012
1 parent e992d19 commit 421f177336b1dbd195952cfee457483ec9f479ba
Showing with 10 additions and 2 deletions.
  1. +6 −0 dygraph-interaction-model.js
  2. +4 −2 dygraph.js
@@ -329,9 +329,11 @@ Dygraph.Interaction.endZoom = function(event, g, context) {
if (regionWidth >= 10 && context.dragDirection == Dygraph.HORIZONTAL) {
g.doZoomX_(Math.min(context.dragStartX, context.dragEndX),
Math.max(context.dragStartX, context.dragEndX));
context.cancelNextDblclick = true;
} else if (regionHeight >= 10 && context.dragDirection == Dygraph.VERTICAL) {
g.doZoomY_(Math.min(context.dragStartY, context.dragEndY),
Math.max(context.dragStartY, context.dragEndY));
context.cancelNextDblclick = true;
} else {
g.clearZoomRect_();
}
@@ -548,6 +550,10 @@ Dygraph.Interaction.defaultModel = {
// Disable zooming out if panning.
dblclick: function(event, g, context) {
if (context.cancelNextDblclick) {
context.cancelNextDblclick = false;
return;
}
if (event.altKey || event.shiftKey) {
return;
}
View
@@ -851,12 +851,12 @@ Dygraph.prototype.createInterface_ = function() {
var dygraph = this;
this.mouseMoveHandler = function(e) {
dygraph.mouseMove_(e);
dygraph.mouseMove_(e);
};
Dygraph.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler);
this.mouseOutHandler = function(e) {
dygraph.mouseOut_(e);
dygraph.mouseOut_(e);
};
Dygraph.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler);
@@ -1120,6 +1120,7 @@ Dygraph.prototype.createDragInterface_ = function() {
prevEndX: null, // pixel coordinates
prevEndY: null, // pixel coordinates
prevDragDirection: null,
cancelNextDblclick: false, // see comment in dygraph-interaction-model.js
// The value on the left side of the graph when a pan operation starts.
initialLeftmostDate: null,
@@ -1156,6 +1157,7 @@ Dygraph.prototype.createDragInterface_ = function() {
context.py = Dygraph.findPosY(g.canvas_);
context.dragStartX = g.dragGetX_(event, context);
context.dragStartY = g.dragGetY_(event, context);
context.cancelNextDblclick = false;
}
};

1 comment on commit 421f177

@kberg

This comment has been minimized.

Show comment
Hide comment
@kberg

kberg Mar 30, 2012

Collaborator

This commit broke a test. Specifically

?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom

AssertError: expected 1 but was 45.1
at fail (.../dygraphs/auto_tests/lib/Asserts.js:22:13)
at assertEquals (.../dygraphs/auto_tests/lib/Asserts.js:158:5)
at [object Object].testCorrectAxisValueRangeAfterUnzoom (.../dygraphs/auto_tests/tests/interaction_model.js:364:3)
at [object Object].runTest (.../dygraphs/auto_tests/misc/fake-jstestdriver.js:76:10)
at processVariables (.../dygraphs/auto_tests/misc/local.html?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom&command=runTest:93:24)
at .../dygraphs/auto_tests/misc/local.html?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom&command=runTest:175:1
fake-jstestdriver.js:140Loaded 117 tests in 24 test cases

Collaborator

kberg commented on 421f177 Mar 30, 2012

This commit broke a test. Specifically

?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom

AssertError: expected 1 but was 45.1
at fail (.../dygraphs/auto_tests/lib/Asserts.js:22:13)
at assertEquals (.../dygraphs/auto_tests/lib/Asserts.js:158:5)
at [object Object].testCorrectAxisValueRangeAfterUnzoom (.../dygraphs/auto_tests/tests/interaction_model.js:364:3)
at [object Object].runTest (.../dygraphs/auto_tests/misc/fake-jstestdriver.js:76:10)
at processVariables (.../dygraphs/auto_tests/misc/local.html?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom&command=runTest:93:24)
at .../dygraphs/auto_tests/misc/local.html?testCaseName=interaction-model&test=testCorrectAxisValueRangeAfterUnzoom&command=runTest:175:1
fake-jstestdriver.js:140Loaded 117 tests in 24 test cases

Please sign in to comment.