Commit 359db6d2 authored by David Schnur's avatar David Schnur

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.
parents c0148d0e e6034456
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment