Merge pull request #34 from alenyashka/master

Adds arguments to the plotzoom event and fixes the bug where zooming could overrun a plot's pan range.
pull/1/head
David Schnur 14 years ago
commit 359db6d2d7

@ -234,7 +234,8 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
var opts = axis.options,
min = minmax[axis.direction].min,
max = minmax[axis.direction].max,
zr = opts.zoomRange;
zr = opts.zoomRange,
pr = opts.panRange;
if (zr === false) // no zooming on this axis
return;
@ -248,6 +249,16 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
max = tmp;
}
//Check that we are in panRange
if (pr) {
if (pr[0] != null && min < pr[0]) {
min = pr[0];
}
if (pr[1] != null && max > pr[1]) {
max = pr[1];
}
}
var range = max - min;
if (zr &&
((zr[0] != null && range < zr[0]) ||
@ -262,7 +273,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
plot.draw();
if (!args.preventEvent)
plot.getPlaceholder().trigger("plotzoom", [ plot ]);
plot.getPlaceholder().trigger("plotzoom", [ plot, args ]);
}
plot.pan = function (args) {

Loading…
Cancel
Save