From 39f7ca586f5d2b936df403ce26a4260e12af947b Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Fri, 6 Jun 2014 11:46:50 +0200 Subject: [PATCH] [cooja] plugins/Visualizer: Mouse release always terminates previous action and reses actions state and cursor appearance Also renamed UNKNOWN state to NONE as it is a more adequate name for the new behavior --- .../org/contikios/cooja/plugins/Visualizer.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java index 1418b5b6f..bb9df74db 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java @@ -160,12 +160,16 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { private static final int MOVE_MASK = Event.SHIFT_MASK; enum MotesActionState { - - UNKNWON, + NONE, + // press to select mote SELECT_PRESS, + // press DEFAULT_PRESS, + // press to start panning PAN_PRESS, + // panning the viewport PANNING, + // moving a mote MOVING, // rectangular select SELECTING @@ -176,7 +180,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { /* Mote that was under curser while mouse press */ Mote cursorMote; - MotesActionState mouseActionState = MotesActionState.UNKNWON; + MotesActionState mouseActionState = MotesActionState.NONE; /* Position where mouse button was pressed */ Position pressedPos; @@ -1038,6 +1042,9 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { repaint(); break; } + /* Release always stops previous actions */ + mouseActionState = MotesActionState.NONE; + canvas.setCursor(Cursor.getDefaultCursor()); repaint(); }