TomTroppmann 2 年之前
父节点
当前提交
a7d8a5b4ea
共有 2 个文件被更改,包括 7 次插入6 次删除
  1. 2 2
      src/ui/view/canvas/Canvas.java
  2. 5 4
      src/utility/Vector2Int.java

+ 2 - 2
src/ui/view/canvas/Canvas.java

@@ -116,7 +116,7 @@ public class Canvas extends AbstractCanvas implements MouseListener, MouseMotion
 			// save old Position
 			savePos = new ArrayList<>();
 			for (int i = 0; i < animCps.size(); i++) {
-				savePos.add(animCps.get(i).getPosition().clone());
+				savePos.add(new Vector2Int(animCps.get(i).getPosition()));
 			}
 
 			animT = new javax.swing.Timer(animDelay, actionEvent1 -> {
@@ -157,7 +157,7 @@ public class Canvas extends AbstractCanvas implements MouseListener, MouseMotion
 			controller.ungroupGroupNode((GroupNode) tempCps, groupNode);
 
 			for (int i = 0; i < animCps.size(); i++) {
-				savePos.add(animCps.get(i).getPosition().clone());
+				savePos.add(new Vector2Int(animCps.get(i).getPosition()));
 			}
 			for (AbstractCanvasObject cps : animCps) {
 				int x = tempCps.getPosition().getX();

+ 5 - 4
src/utility/Vector2Int.java

@@ -20,7 +20,11 @@ public class Vector2Int {
 		setX(x);
 		setY(y);
 	}
-
+	public Vector2Int(Vector2Int other)
+	{
+		x = other.x;
+		y = other.y;
+	}
 	public void setX(int x) {
 		this.x = x;
 	}
@@ -139,7 +143,4 @@ public class Vector2Int {
 		return "X: " + x + " Y: " + y;
 	}
 	
-	public Vector2Int clone() {
-		return new Vector2Int(x, y);
-	}
 }