Kevin Trometer 7 лет назад
Родитель
Сommit
7001779a99
1 измененных файлов с 16 добавлено и 1 удалено
  1. 16 1
      src/ui/view/UnitGraph.java

+ 16 - 1
src/ui/view/UnitGraph.java

@@ -203,9 +203,22 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 				g2.setStroke(new BasicStroke(2));
 				g2.setColor(Color.BLACK);
 				for (int i = 0; i < pointList.size() - 1; i++) {
+					// Left out of bounce
 					if ((i == 1 || i == 2) && pointList.get(i).getX() < 0) {
 						line = new Line2D.Double(border, pointList.get(i).getY() * scaleY, border,
 								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 {
 						line = new Line2D.Double(pointList.get(i).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
-			if (tempP != null && pointDrag) {
+			if (tempP != null && pointDrag)
+
+			{
 				try {
 					int i;
 					for (i = 0; (i * (this.getWidth() - (border * 2)) / (model.getIterations() - 1)