diff options
author | Peter Chiocchetti | 2014-12-13 12:38:32 +0100 |
---|---|---|
committer | Pim van den Berg | 2014-12-13 12:40:43 +0100 |
commit | bd029dfebd07ae4a6e188e8623cf99b228e5d577 (patch) | |
tree | 65ceb9306db00b3e6004b9ee94d648896d1ec51e /js | |
parent | plugins/ping: show ping_droprate in percentage (diff) | |
download | apt-panopticon_cgp-bd029dfebd07ae4a6e188e8623cf99b228e5d577.zip apt-panopticon_cgp-bd029dfebd07ae4a6e188e8623cf99b228e5d577.tar.gz apt-panopticon_cgp-bd029dfebd07ae4a6e188e8623cf99b228e5d577.tar.bz2 apt-panopticon_cgp-bd029dfebd07ae4a6e188e8623cf99b228e5d577.tar.xz |
js/CGP: scroll wheel zoom center position
Closes #111
Diffstat (limited to '')
-rw-r--r-- | js/CGP.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -44,8 +44,10 @@ var CGP = (function() { | |||
44 | if (this.stidx < 0) this.stidx = 0; | 44 | if (this.stidx < 0) this.stidx = 0; |
45 | } | 45 | } |
46 | if (cstime !== this.stime[this.stidx]) { | 46 | if (cstime !== this.stime[this.stidx]) { |
47 | var middle = this.rrdgraph.start + Math.abs(Math.round((this.rrdgraph.end - this.rrdgraph.start) / 2)); | 47 | var posx = e.clientX - e.target.getBoundingClientRect().left - this.rrdgraph.xorigin; |
48 | this.rrdgraph.start = Math.round(middle - this.stime[this.stidx] / 2); | 48 | var relx = this.rrdgraph.xsize / Math.min(Math.max(posx, 0), this.rrdgraph.xsize); |
49 | var cntr = this.rrdgraph.start + Math.abs(Math.round((this.rrdgraph.end - this.rrdgraph.start) / relx)); | ||
50 | this.rrdgraph.start = Math.round(cntr - this.stime[this.stidx] / relx); | ||
49 | this.rrdgraph.end = this.rrdgraph.start + this.stime[this.stidx]; | 51 | this.rrdgraph.end = this.rrdgraph.start + this.stime[this.stidx]; |
50 | 52 | ||
51 | try { | 53 | try { |