Merge pull request #8 from sdawans/cooja-fix-vis-move
Fixes COOJA Network Visualiser glitch when clicking on a mote
This commit is contained in:
commit
7c29724ee8
1 changed files with 34 additions and 30 deletions
|
@ -155,6 +155,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
private Position zoomingPosition = null; /* Zooming center position */
|
private Position zoomingPosition = null; /* Zooming center position */
|
||||||
private Point zoomingPixel = null; /* Zooming center pixel */
|
private Point zoomingPixel = null; /* Zooming center pixel */
|
||||||
private boolean moving = false;
|
private boolean moving = false;
|
||||||
|
private Point mouseDownPixel = null; /* Records position of mouse down to differentiate a click from a move */
|
||||||
private Mote movedMote = null;
|
private Mote movedMote = null;
|
||||||
public Mote clickedMote = null;
|
public Mote clickedMote = null;
|
||||||
private long moveStartTime = -1;
|
private long moveStartTime = -1;
|
||||||
|
@ -813,6 +814,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
|
|
||||||
if (motes != null && motes.length > 0) {
|
if (motes != null && motes.length > 0) {
|
||||||
/* One of the clicked motes should be moved */
|
/* One of the clicked motes should be moved */
|
||||||
|
mouseDownPixel = new Point(x, y);
|
||||||
clickedMote = motes[0];
|
clickedMote = motes[0];
|
||||||
beginMoveRequest(motes[0], false, false);
|
beginMoveRequest(motes[0], false, false);
|
||||||
}
|
}
|
||||||
|
@ -902,6 +904,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
|
|
||||||
/* Moving */
|
/* Moving */
|
||||||
if (moving) {
|
if (moving) {
|
||||||
|
if(x != mouseDownPixel.x || y != mouseDownPixel.y) {
|
||||||
Position newPos = transformPixelToPosition(x, y);
|
Position newPos = transformPixelToPosition(x, y);
|
||||||
|
|
||||||
if (!stop) {
|
if (!stop) {
|
||||||
|
@ -941,6 +944,7 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
moving = false;
|
moving = false;
|
||||||
movedMote = null;
|
movedMote = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue