|
@@ -203,9 +203,22 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
g2.setStroke(new BasicStroke(2));
|
|
g2.setStroke(new BasicStroke(2));
|
|
g2.setColor(Color.BLACK);
|
|
g2.setColor(Color.BLACK);
|
|
for (int i = 0; i < pointList.size() - 1; i++) {
|
|
for (int i = 0; i < pointList.size() - 1; i++) {
|
|
|
|
+ // Left out of bounce
|
|
if ((i == 1 || i == 2) && pointList.get(i).getX() < 0) {
|
|
if ((i == 1 || i == 2) && pointList.get(i).getX() < 0) {
|
|
line = new Line2D.Double(border, pointList.get(i).getY() * scaleY, border,
|
|
line = new Line2D.Double(border, pointList.get(i).getY() * scaleY, border,
|
|
pointList.get(i + 1).getY() * scaleY);
|
|
pointList.get(i + 1).getY() * scaleY);
|
|
|
|
+ }
|
|
|
|
+ // Right out of bounce
|
|
|
|
+ else if (i == pointList.size() - 4 && pointList.get(pointList.size() - 3).getX() > width) {
|
|
|
|
+ line = new Line2D.Double(pointList.get(i).getX() * scaleX + border,
|
|
|
|
+ pointList.get(i).getY() * scaleY, this.getWidth() - border,
|
|
|
|
+ pointList.get(i + 1).getY() * scaleY);
|
|
|
|
+ } else if (i == pointList.size() - 3 && pointList.get(pointList.size() - 3).getX() > width) {
|
|
|
|
+ line = new Line2D.Double(this.getWidth() - border, pointList.get(i).getY() * scaleY,
|
|
|
|
+ this.getWidth() - border, pointList.get(i + 1).getY() * scaleY);
|
|
|
|
+ } else if (i == pointList.size() - 2 && pointList.get(pointList.size() - 2).getX() > width) {
|
|
|
|
+ line = new Line2D.Double(this.getWidth() - border, pointList.get(i).getY() * scaleY,
|
|
|
|
+ pointList.get(i + 1).getX() * scaleX + border, pointList.get(i + 1).getY() * scaleY);
|
|
} else {
|
|
} else {
|
|
line = new Line2D.Double(pointList.get(i).getX() * scaleX + border,
|
|
line = new Line2D.Double(pointList.get(i).getX() * scaleX + border,
|
|
pointList.get(i).getY() * scaleY, pointList.get(i + 1).getX() * scaleX + border,
|
|
pointList.get(i).getY() * scaleY, pointList.get(i + 1).getX() * scaleX + border,
|
|
@@ -243,7 +256,9 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
|
|
|
}
|
|
}
|
|
// When the switch graph is dragged
|
|
// When the switch graph is dragged
|
|
- if (tempP != null && pointDrag) {
|
|
|
|
|
|
+ if (tempP != null && pointDrag)
|
|
|
|
+
|
|
|
|
+ {
|
|
try {
|
|
try {
|
|
int i;
|
|
int i;
|
|
for (i = 0; (i * (this.getWidth() - (border * 2)) / (model.getIterations() - 1)
|
|
for (i = 0; (i * (this.getWidth() - (border * 2)) / (model.getIterations() - 1)
|