[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
This commit is contained in:
Enrico Joerns 2014-06-06 11:46:50 +02:00
parent 2465a361e3
commit 39f7ca586f

View File

@ -160,12 +160,16 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
private static final int MOVE_MASK = Event.SHIFT_MASK; private static final int MOVE_MASK = Event.SHIFT_MASK;
enum MotesActionState { enum MotesActionState {
NONE,
UNKNWON, // press to select mote
SELECT_PRESS, SELECT_PRESS,
// press
DEFAULT_PRESS, DEFAULT_PRESS,
// press to start panning
PAN_PRESS, PAN_PRESS,
// panning the viewport
PANNING, PANNING,
// moving a mote
MOVING, MOVING,
// rectangular select // rectangular select
SELECTING SELECTING
@ -176,7 +180,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
/* Mote that was under curser while mouse press */ /* Mote that was under curser while mouse press */
Mote cursorMote; Mote cursorMote;
MotesActionState mouseActionState = MotesActionState.UNKNWON; MotesActionState mouseActionState = MotesActionState.NONE;
/* Position where mouse button was pressed */ /* Position where mouse button was pressed */
Position pressedPos; Position pressedPos;
@ -1038,6 +1042,9 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
repaint(); repaint();
break; break;
} }
/* Release always stops previous actions */
mouseActionState = MotesActionState.NONE;
canvas.setCursor(Cursor.getDefaultCursor());
repaint(); repaint();
} }