Procházet zdrojové kódy

Keine objekte erstellen wenn außerhalbt von canvas gedragged

Kevin Trometer před 8 roky
rodič
revize
059c7318e4
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. binární
      bin/ui/view/GUI.class
  2. 3 1
      src/ui/view/GUI.java

binární
bin/ui/view/GUI.class


+ 3 - 1
src/ui/view/GUI.java

@@ -212,6 +212,8 @@ public class GUI implements CategoryListener {
 			public void mouseReleased(MouseEvent e) {
 				try {
 					if (dragging) {
+						int x = (int) canvas.getMousePosition().getX();
+						int y = (int) canvas.getMousePosition().getY();
 						CpsObject h = null;
 						if (tempCps.getClass() == HolonObject.class) {
 							h = new HolonObject(tempCps);
@@ -223,7 +225,7 @@ public class GUI implements CategoryListener {
 							h = new HolonTransformer(tempCps);
 						}
 
-						h.setPosition((int) canvas.getMousePosition().getX(), (int) canvas.getMousePosition().getY());
+						h.setPosition(x, y);
 						controller.addObjectCanvas(h);
 						for (int i = 0; i < model.getObjectsOnCanvas().size(); i++) {
 							CpsObject temp = model.getObjectsOnCanvas().get(i);