tmf: Fix lingering zoom range markers on mouse release
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 23 Aug 2016 18:00:08 +0000 (14:00 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 24 Aug 2016 14:23:13 +0000 (10:23 -0400)
When zooming with the right mouse button, when the button is released
the drag state should be reset before the change of window range redraws
so that the zoom drag selection lines and background are not drawn one
last time.

The redraw used to trigger the paint event after a short delay (in the
platform) at which time the drag state had been reset, but a recent
change in the time graph viewer has forced the paint event to happen
immediately by a call to Control.update().

Change-Id: Ifd60e2053bd7736ca37749cb1b299ea0d4852d79
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/79552
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java

index 008f084455163080dba76d1d093fc231944e9d69..6263b622b2414fbacf157d9a9a4db9d3fd3788f3 100644 (file)
@@ -2816,14 +2816,15 @@ public class TimeGraphControl extends TimeGraphBaseControl
         if (DRAG_NONE != fDragState) {
             setCapture(false);
             if (e.button == fDragButton && DRAG_TRACE_ITEM == fDragState) {
+                fDragState = DRAG_NONE;
                 if (fDragX != fDragX0) {
                     fTimeProvider.notifyStartFinishTime();
                 }
-                fDragState = DRAG_NONE;
             } else if (e.button == fDragButton && DRAG_SPLIT_LINE == fDragState) {
                 fDragState = DRAG_NONE;
                 redraw();
             }  else if (e.button == fDragButton && DRAG_SELECTION == fDragState) {
+                fDragState = DRAG_NONE;
                 if (fDragX == fDragX0) { // click without selecting anything
                     long time = getTimeAtX(e.x);
                     fTimeProvider.setSelectedTimeNotify(time, false);
@@ -2832,10 +2833,10 @@ public class TimeGraphControl extends TimeGraphBaseControl
                     long time1 = fDragBeginMarker ? fDragTime0 : getTimeAtX(fDragX);
                     fTimeProvider.setSelectionRangeNotify(time0, time1, false);
                 }
-                fDragState = DRAG_NONE;
                 redraw();
                 fTimeGraphScale.setDragRange(-1, -1);
             } else if (e.button == fDragButton && DRAG_ZOOM == fDragState) {
+                fDragState = DRAG_NONE;
                 int nameWidth = fTimeProvider.getNameSpace();
                 if ((Math.max(fDragX, fDragX0) > nameWidth) && !isInDragZoomMargin()) {
                     long time0 = getTimeAtX(fDragX0);
@@ -2848,7 +2849,6 @@ public class TimeGraphControl extends TimeGraphBaseControl
                 } else {
                     redraw();
                 }
-                fDragState = DRAG_NONE;
                 fTimeGraphScale.setDragRange(-1, -1);
             }
         }
This page took 0.02644 seconds and 5 git commands to generate.