|
@@ -835,20 +835,20 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
|
|
|
// Make sure its in bounds
|
|
|
if (e.getX() < controller.getScaleDiv2())
|
|
|
- x = 0;
|
|
|
+ x = controller.getScaleDiv2();
|
|
|
else if (e.getX() > this.getWidth() - controller.getScaleDiv2())
|
|
|
- x = this.getWidth() - controller.getScale();
|
|
|
+ x = this.getWidth() - controller.getScaleDiv2();
|
|
|
if (e.getY() < controller.getScaleDiv2())
|
|
|
- y = 0;
|
|
|
+ y = controller.getScaleDiv2();
|
|
|
else if (e.getY() > this.getHeight() - controller.getScaleDiv2())
|
|
|
- y = this.getHeight() - controller.getScale();
|
|
|
+ y = this.getHeight() - controller.getScaleDiv2();
|
|
|
|
|
|
// Distance
|
|
|
xDist = x - tempCps.getPosition().x;
|
|
|
yDist = y - tempCps.getPosition().y;
|
|
|
|
|
|
tempCps.setPosition(x, y); // Drag Position
|
|
|
- // TipText Position and name
|
|
|
+ // ToolTipText Position and name
|
|
|
toolTip = true;
|
|
|
toolTipText = tempCps.getName() + ", " + tempCps.getId();
|
|
|
toolTipPos.x = tempCps.getPosition().x - controller.getScaleDiv2();
|
|
@@ -861,14 +861,14 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
y = (int) (cps.getPosition().y + yDist);
|
|
|
|
|
|
// Make sure its in bounds
|
|
|
- if (x <= 0)
|
|
|
- x = 0;
|
|
|
- else if (x > this.getWidth() - controller.getScale())
|
|
|
- x = this.getWidth() - controller.getScale();
|
|
|
- if (y <= 0)
|
|
|
- y = 0;
|
|
|
- else if (y > this.getHeight() - controller.getScale())
|
|
|
- y = this.getHeight() - controller.getScale();
|
|
|
+ if (x <= controller.getScaleDiv2())
|
|
|
+ x = controller.getScaleDiv2();
|
|
|
+ else if (x > this.getWidth() - controller.getScaleDiv2())
|
|
|
+ x = this.getWidth() - controller.getScaleDiv2();
|
|
|
+ if (y <= controller.getScaleDiv2())
|
|
|
+ y = controller.getScaleDiv2();
|
|
|
+ else if (y > this.getHeight() - controller.getScaleDiv2())
|
|
|
+ y = this.getHeight() - controller.getScaleDiv2();
|
|
|
|
|
|
cps.setPosition(x, y);
|
|
|
}
|