瀏覽代碼

deselect fix

Kevin Trometer 8 年之前
父節點
當前提交
194f97a63b
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/ui/view/GUI.java

+ 5 - 4
src/ui/view/GUI.java

@@ -170,6 +170,7 @@ public class GUI<E> implements CategoryListener {
 	private int xTHIS;
 	private int yBTHIS;
 	private int xBTHIS;
+	private CpsObject temp = null;
 
 	/**
 	 * Create the application.
@@ -661,7 +662,10 @@ public class GUI<E> implements CategoryListener {
 		canvas.addMouseListener(new MouseAdapter() {
 			@Override
 			public void mousePressed(MouseEvent e) {
-				CpsObject temp = getActualCps();
+				if(temp == null || temp.getID() != model.getSelectedObjectID()){
+					unitGraph.empty();
+				}				
+				temp = getActualCps();
 				// Update of the Information about the HolonElements - only for
 				if (temp instanceof HolonObject) {
 					refreshTableHolonElement();
@@ -730,9 +734,6 @@ public class GUI<E> implements CategoryListener {
 				} else if (getActualCps() == null) {
 					deleteRows();
 				} 
-				if(model.getSelectedObjectID() == 0){
-					unitGraph.empty();
-				}
 			}
 
 		});