tmf: Fix zoom with mouse drag on time graph scale
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 13 Jan 2017 19:49:06 +0000 (14:49 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 25 Jan 2017 16:23:24 +0000 (11:23 -0500)
The time graph scale no longer has a name space. It is now occupied by
the time graph viewer's tree header.

Change-Id: I3f28227b66b83510e871eaeaeac522f09e424d1e
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/88683
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphScale.java

index af4670a0981285f702bad7e6f9b798bb246728bc..3463f97a40720266a423807dc759516e4e42817f 100644 (file)
@@ -518,18 +518,12 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     public void mouseDown(MouseEvent e) {
         getParent().setFocus();
         if (fDragState == NO_BUTTON && null != fTimeProvider) {
-            int x = e.x - fTimeProvider.getNameSpace();
-            if (LEFT_BUTTON == e.button && x > 0) {
+            if (LEFT_BUTTON == e.button && e.x > 0) {
                 setCapture(true);
                 fDragState = LEFT_BUTTON;
             }
-            if (x < 0) {
-                x = 0;
-            } else if (x > getSize().x - fTimeProvider.getNameSpace()) {
-                x = getSize().x - fTimeProvider.getNameSpace();
-            }
-            fDragX = x;
-            fDragX0 = x;
+            fDragX = e.x;
+            fDragX0 = e.x;
             fTime0bak = fTimeProvider.getTime0();
             fTime1bak = fTimeProvider.getTime1();
         }
@@ -553,12 +547,9 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
         if (fDragX0 < 0 || fDragState == NO_BUTTON || fTimeProvider == null) {
             return;
         }
-        Point size = getSize();
-        int leftSpace = fTimeProvider.getNameSpace();
-        int x = e.x - leftSpace;
         if (LEFT_BUTTON == fDragState) {
-            if (x > 0 && size.x > leftSpace && fDragX != x) {
-                fDragX = x;
+            if (e.x > 0 && fDragX != e.x) {
+                fDragX = e.x;
                 if (fTimeProvider.getTime0() == fTimeProvider.getTime1()) {
                     return;
                 }
This page took 0.026228 seconds and 5 git commands to generate.