Kevin Trometer 8 年之前
父节点
当前提交
6e6bad0349
共有 1 个文件被更改,包括 15 次插入4 次删除
  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