Browse Source

verbesserung aber immer noch buggy

Kevin Trometer 8 years ago
parent
commit
f6ad54e846
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/ui/view/UnitGraph.java

+ 6 - 3
src/ui/view/UnitGraph.java

@@ -223,13 +223,13 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 
 			if (pointList.get(i + 1).getY() == tempP.getY()) {
 				// x
-				if (pointList.get(i + 1).getX() <= x || pointList.get(i - 2).getX() >= x) {
+				if (pointList.get(i + 1).getX() <= x+1 || pointList.get(i - 2).getX() >= x-1) {
 					x = tempP.getX();
 				}
 				pointList.get(i - 1).setLocation(x, pointList.get(i - 1).getY());
 			} else {
 				// x
-				if (pointList.get(i + 2).getX() <= x || pointList.get(i - 1).getX() >= x) {
+				if (pointList.get(i + 2).getX() <= x+1 || pointList.get(i - 1).getX() >= x-1) {
 					x = tempP.getX();
 				}
 				pointList.get(i + 1).setLocation(x, pointList.get(i + 1).getY());
@@ -362,7 +362,7 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 							pointList.add(i, new Point((int) (x - dist), (int) height - 1));
 							added = true;
 						} else if (y >= height / 2 && (pointList.get(i - 1).getY() != height - 1
-								|| pointList.get(i).getY() != height - 1)) {
+								&& pointList.get(i).getY() != height - 1)) {
 							pointList.add(i, new Point((int) (x + dist), 0));
 							pointList.add(i, new Point((int) (x + dist), (int) height - 1));
 							pointList.add(i, new Point((int) (x - dist), (int) height - 1));
@@ -372,6 +372,9 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 					}
 				}
 			}
+			for (int i = 0; i < pointList.size(); i++) {
+				System.out.println(pointList.get(i).getX()+", "+pointList.get(i).getY());
+			}
 			repaint();
 		}
 		// TODO Siwtch pressed zeugs hier hin