Browse Source

marker bug

Kevin Trometer 7 years ago
parent
commit
019569833e
3 changed files with 28 additions and 4 deletions
  1. 2 0
      src/ui/view/GUI.java
  2. 12 2
      src/ui/view/MyCanvas.java
  3. 14 2
      src/ui/view/UpperNodeCanvas.java

+ 2 - 0
src/ui/view/GUI.java

@@ -1416,6 +1416,7 @@ public class GUI<E> implements CategoryListener {
 
 								controller.addObjUpperNode(h, unc.upperNode);
 								unc.invalidate();
+								unc.setXY((int)canvas.getMousePosition().getX(), (int)canvas.getMousePosition().getY());
 								unc.repaint();
 							}
 						} else {
@@ -1437,6 +1438,7 @@ public class GUI<E> implements CategoryListener {
 
 							controller.addObjectCanvas(h);
 							canvas.invalidate();
+							canvas.setXY((int)canvas.getMousePosition().getX(), (int)canvas.getMousePosition().getY());
 							canvas.repaint();
 						}
 						controller.calculateStateForCurrentTimeStep();

+ 12 - 2
src/ui/view/MyCanvas.java

@@ -761,7 +761,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			}
 		}
 
-		if (edgeHighlight == null && tempCps == null) {
+		if (edgeHighlight == null && tempCps == null ) {
 			sx = e.getX();
 			sy = e.getY();
 			doMark = true;
@@ -1162,11 +1162,21 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	}
 	
 	/**
-	 * set tooltIp
+	 * set toolTip
 	 * @param bool
 	 */
 	public void setToolTip(boolean bool){
 		this.toolTip = bool;
 	}
 	
+	/**
+	 * Set the Mouse
+	 * @param x
+	 * @param y
+	 */
+	public void setXY(int x, int y){
+		this.x = x;
+		this.y = y;
+	}
+	
 }

+ 14 - 2
src/ui/view/UpperNodeCanvas.java

@@ -1572,13 +1572,25 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 	public void setBackgroundImage(String imagePath, int mode, int width, int height) {
 		upperNode.setBackgroundImage(imagePath, mode, width, height);
 	}
-	
+
 	/**
 	 * set tooltIp
+	 * 
 	 * @param bool
 	 */
-	public void setToolTip(boolean bool){
+	public void setToolTip(boolean bool) {
 		this.toolTip = bool;
 	}
 
+	/**
+	 * Set the Mouse Position on the UpperNodeCanvas;
+	 * 
+	 * @param x
+	 * @param y
+	 */
+	public void setXY(int x, int y) {
+		this.x = x;
+		this.y = y;
+	}
+
 }