Kevin Trometer %!s(int64=8) %!d(string=hai) anos
pai
achega
6e6bad0349
Modificáronse 1 ficheiros con 15 adicións e 4 borrados
  1. 15 4
      src/ui/view/UnitGraph.java

+ 15 - 4
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+1 || pointList.get(i - 2).getX() >= x-1) {
+				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+1 || pointList.get(i - 1).getX() >= x-1) {
+				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());
@@ -372,9 +372,20 @@ 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());
+
+			// Delete a Point
+			if (deletePoint && tempP.getX() != 0
+					&& (tempP.getX() != this.getWidth() / scaleX || tempP != pointList.getLast())) {
+				System.out.println("x: " + tempP.getY());
+				// pointList.remove(tempP);
 			}
+			// Delete This for
+			/*
+			 * 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