From 232e59a08e9b365202149cce8a35c77d54fb6c96 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 7 Nov 2010 23:57:55 +0100 Subject: [PATCH] fixed #28 (autoscaling after scroll-zoom) --- frontend/javascripts/frontend.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/javascripts/frontend.js b/frontend/javascripts/frontend.js index aa7d8ee..fe21727 100644 --- a/frontend/javascripts/frontend.js +++ b/frontend/javascripts/frontend.js @@ -238,12 +238,14 @@ vz.wui.handleControls = function () { vz.options.plot.xaxis.max = middle + year/2; break; } - - // update delta after zoom - delta = vz.options.plot.xaxis.max - vz.options.plot.xaxis.min; + + // reenable autoscaling for yaxis + vz.options.plot.yaxis.min = 0; + vz.options.plot.yaxis.max = null; // we dont want to zoom/pan into the future - if (vz.options.plot.xaxis.max + delta > new Date().getTime()) { + if (vz.options.plot.xaxis.max > new Date().getTime()) { + delta = vz.options.plot.xaxis.max - vz.options.plot.xaxis.min; vz.options.plot.xaxis.max = new Date().getTime(); vz.options.plot.xaxis.min = new Date().getTime() - delta; }