diff options
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 { |