Browse Source

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Edgardo Palza 7 years ago
parent
commit
ad8fd5a748
1 changed files with 15 additions and 4 deletions
  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