[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;
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();
}