From 72de4410e1c8d2d79384dce8eabe884252f0290c Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Mon, 17 Sep 2007 20:30:14 +0000 Subject: when selecting something outside the graph, multiply by 10. Use this to zoom out --- htdocs/cropper/smokeping-zoom.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'htdocs/cropper/smokeping-zoom.js') diff --git a/htdocs/cropper/smokeping-zoom.js b/htdocs/cropper/smokeping-zoom.js index a02ad56..e42a6b0 100644 --- a/htdocs/cropper/smokeping-zoom.js +++ b/htdocs/cropper/smokeping-zoom.js @@ -37,7 +37,7 @@ function changeRRDImage(coords,dimensions){ var RRDRight = 26; // difference between right border of RRD image and content var RRDImgWidth = $('zoom').getDimensions().width; // Width of the Smokeping RRD Graphik var RRDImgUsable = RRDImgWidth - RRDRight - RRDLeft; - var form = $('range_form'); + var form = $('range_form'); if (StartEpoch == 0) StartEpoch = +$F('epoch_start'); @@ -55,9 +55,19 @@ function changeRRDImage(coords,dimensions){ var myURL = myURLObj.getUrlBase(); // Generate Selected Range in Unix Timestamps + var LeftFactor = 1; + var RightFactor = 1; + + if (SelectLeft < RRDLeft) + LeftFactor = 10; + + var NewStartEpoch = Math.floor(StartEpoch + (SelectLeft - RRDLeft) * DivEpoch / RRDImgUsable * LeftFactor ); + + if (SelectRight > RRDImgWidth - RRDRight) + RightFactor = 10; + + EndEpoch = Math.ceil(StartEpoch + (SelectRight - RRDLeft) * DivEpoch / RRDImgUsable * RightFactor); - var NewStartEpoch = Math.floor(StartEpoch + (SelectLeft - RRDLeft) * DivEpoch / RRDImgUsable ); - EndEpoch = Math.ceil(StartEpoch + (SelectRight - RRDLeft) * DivEpoch / RRDImgUsable ); StartEpoch = NewStartEpoch; $('zoom').src = myURL + '?displaymode=a;start=' + StartEpoch + ';end=' + EndEpoch + ';target=' + Target; -- cgit v1.2.3-24-g4f1b