summaryrefslogtreecommitdiffstats
path: root/htdocs/cropper
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2007-09-17 22:30:14 +0200
committerTobi Oetiker <tobi@oetiker.ch>2007-09-17 22:30:14 +0200
commit72de4410e1c8d2d79384dce8eabe884252f0290c (patch)
tree46ac559f3e6188b7e0399c53e71cf27767a564b5 /htdocs/cropper
parent3ab95c6f225b3cc697e0431ec5e23c782279acf9 (diff)
downloadsmokeping-72de4410e1c8d2d79384dce8eabe884252f0290c.tar.gz
smokeping-72de4410e1c8d2d79384dce8eabe884252f0290c.tar.xz
when selecting something outside the graph, multiply by 10. Use this to zoom out
Diffstat (limited to 'htdocs/cropper')
-rw-r--r--htdocs/cropper/smokeping-zoom.js16
1 files changed, 13 insertions, 3 deletions
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;