Kaynağa Gözat

doubleclick adjustments

Kevin Trometer 8 yıl önce
ebeveyn
işleme
c63bd66568
2 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 2 2
      src/ui/view/GUI.java
  2. 7 3
      src/ui/view/MyCanvas.java

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

@@ -1285,7 +1285,7 @@ public class GUI<E> implements CategoryListener {
 				// Write new data in the PropertyTable
 				updCon.paintProperties(temp);
 				// New Tab with NodeOfNode
-				if (doubleClick() && temp instanceof CpsUpperNode) {
+				if (doubleClick() && MouseEvent.BUTTON3 != e.getButton() && temp instanceof CpsUpperNode) {
 					openNewUpperNodeTab();
 				}
 			}
@@ -1878,7 +1878,7 @@ public class GUI<E> implements CategoryListener {
 				public void mousePressed(MouseEvent e) {
 					temp = ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getSelectedComponent()).getViewport()
 							.getComponent(0)).tempCps;
-					if (doubleClick() && temp instanceof CpsUpperNode) {
+					if (doubleClick()&& MouseEvent.BUTTON3 != e.getButton() && temp instanceof CpsUpperNode) {
 						openNewUpperNodeTab();
 					}
 					// updCon.refreshTableProperties(table);

+ 7 - 3
src/ui/view/MyCanvas.java

@@ -90,7 +90,9 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	int animDuration = 500; // animation Duration
 	int animDelay = animDuration/animFPS; // animation Delay
 	int animSteps = animDuration / animDelay; // animation Steps;
-
+	long start = 0;    
+	long elapsedTime = 0;
+	
 	// contains the value of the Capacity for new created Edges
 
 	/**
@@ -168,7 +170,6 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 							repaint();
 							animDuration -= animDelay;
 							animSteps--;
-							controller.addTextToConsole("" + animDuration);
 						} else {
 							animDuration = 500;
 							animSteps = animDuration / animDelay; 
@@ -180,9 +181,12 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 							controller.addUpperNode("NodeOfNode", null);
 							controller.calculateStateForCurrentTimeStep();
 							repaint();
+							elapsedTime = System.currentTimeMillis() - start;
+							controller.addTextToConsole(elapsedTime+"");
 						}
 					}
 				});
+				start = System.currentTimeMillis();
 				animT.start();
 			}
 		});
@@ -641,7 +645,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			tempSelected.clear();
 		}
 
-		if (doubleClick() && tempCps != null && tempCps instanceof HolonSwitch) {
+		if (doubleClick() && tempCps != null && tempCps instanceof HolonSwitch && MouseEvent.BUTTON3 != e.getButton()) {
 			((HolonSwitch) tempCps).switchState();
 		}