Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2012-07-12 14:06:30 -0400
committerFrancois Chouinard2012-07-12 14:06:30 -0400
commita0192e412d24c321ff74c1de655a42ff87ac3464 (patch)
tree56338f1fb8b1c22ef935eda4b568753dad1ab836
parent89f9d2f111b86ecc5cfecb848a0ef74a8fa4d99d (diff)
downloadorg.eclipse.linuxtools-a0192e412d24c321ff74c1de655a42ff87ac3464.tar.gz
org.eclipse.linuxtools-a0192e412d24c321ff74c1de655a42ff87ac3464.tar.xz
org.eclipse.linuxtools-a0192e412d24c321ff74c1de655a42ff87ac3464.zip
Re-work the zoom function in Histogram View (fix for Bug384977)
Signed-off-by: Francois Chouinard <fchouinard@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java8
1 files changed, 2 insertions, 6 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java
index 1b2d88d694..7d837aea91 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java
@@ -159,14 +159,11 @@ public class HistogramZoom implements MouseWheelListener {
// MouseWheelListener
// ------------------------------------------------------------------------
- private long fMouseTimestamp = 0;
-
@Override
public synchronized void mouseScrolled(MouseEvent event) {
if (fScrollCounter == null) {
fScrollCounter = new MouseScrollCounter(this);
fScrollCounter.start();
- fMouseTimestamp = fHistogram.getTimestamp(event.x);
}
fScrollCounter.incrementMouseScroll(event.count);
}
@@ -178,9 +175,8 @@ public class HistogramZoom implements MouseWheelListener {
// Compute the new time range
long requestedRange = (nbClicks > 0) ? Math.round(ZOOM_FACTOR * fRangeDuration) : (long) Math.ceil(fRangeDuration * (1.0 / ZOOM_FACTOR));
- // Perform a proportional zoom wrt the mouse position
- double ratio = ((double) (fMouseTimestamp - fRangeStartTime)) / fRangeDuration;
- long requestedStart = validateStart(fRangeStartTime + (long) ((fRangeDuration - requestedRange) * ratio));
+ // Distribute delta and adjust for boundaries
+ long requestedStart = validateStart(fRangeStartTime + (long) ((fRangeDuration - requestedRange) / 2));
long requestedEnd = validateEnd(requestedStart, requestedStart + requestedRange);
requestedStart = validateStart(requestedEnd - requestedRange);

Back to the top