Skip to content
This repository
Browse code

fixing problem described in issue #34

  • Loading branch information...
commit 0d4cf16469721761231783267179c1182f760b23 1 parent b795a83
authored January 19, 2012
20  src/main/resources/webapp/js/jit.js
@@ -14984,8 +14984,9 @@ TM.Base = {
14984 14984
   Sets the parent node of the current selected node as root.
14985 14985
 
14986 14986
  */
14987  
-  out: function(){
14988  
-    if(this.busy) return;
  14987
+  out: function(node){
  14988
+	  
  14989
+    if(this.busy && !node) return;
14989 14990
     this.busy = true;
14990 14991
     this.events.hoveredNode = false;
14991 14992
     var that = this,
@@ -14997,6 +14998,7 @@ TM.Base = {
14997 14998
         clickedNode = parent,
14998 14999
         previousClickedNode = this.clickedNode;
14999 15000
     
  15001
+    
15000 15002
     //if no parents return
15001 15003
     if(!parent) {
15002 15004
       this.busy = false;
@@ -15009,9 +15011,14 @@ TM.Base = {
15009 15011
         if(config.request) {
15010 15012
           that.requestNodes(parent, {
15011 15013
             onComplete: function() {
15012  
-              that.compute();
15013  
-              that.plot();
15014  
-              that.busy = false;
  15014
+            	if(node && clickedNode!=node){
  15015
+            		that.out(node);
  15016
+            		that.busy = false;
  15017
+            	}else{
  15018
+            		that.compute();
  15019
+            		that.plot();
  15020
+            		that.busy = false;
  15021
+            	}
15015 15022
             }
15016 15023
           });
15017 15024
         } else {
@@ -15025,7 +15032,8 @@ TM.Base = {
15025 15032
     if (config.levelsToShow > 0)
15026 15033
       this.geom.setRightLevelToShow(parent);
15027 15034
     //animate node positions
15028  
-    if(config.animate) {
  15035
+    if((config.animate && !node) || (config.animate && clickedNode==node)) {
  15036
+    	console.log("animate");
15029 15037
       this.clickedNode = clickedNode;
15030 15038
       this.compute('end');
15031 15039
       //animate the visible subtree only
79  src/main/resources/webapp/js/treemap.js
@@ -33,85 +33,8 @@ var JsonB;
33 33
 
34 34
 function goToNode(nodeId) {
35 35
 	var node = tm.graph.getNode(nodeId);
36  
-
37  
-	if (tm.busy)
38  
-		return;
39  
-	tm.busy = true;
40  
-	tm.events.hoveredNode = false;
41  
-	if (nodeId == tm.root) {
42  
-		var that = tm, 
43  
-		config = tm.config, 
44  
-		graph = tm.graph, 
45  
-		parents = node.getParents(), 
46  
-		parent = node, 
47  
-		clickedNode = node,
48  
-		previousClickedNode = tm.clickedNode;
49  
-	} else {
50  
-		var that = tm, 
51  
-		config = tm.config, 
52  
-		graph = tm.graph, 
53  
-		parents = node.getParents(), 
54  
-		parent = parents[0], 
55  
-		clickedNode = parent, 
56  
-		previousClickedNode = tm.clickedNode;
57  
-	}
58  
-
59  
-	// final plot callback
60  
-	callback = {
61  
-		onComplete : function() {
62  
-			that.clickedNode = parent;
63  
-			if (config.request) {
64  
-				that.requestNodes(parent, {
65  
-					onComplete : function() {
66  
-						that.compute();
67  
-						that.plot();
68  
-						that.busy = false;
69  
-					}
70  
-				});
71  
-			} else {
72  
-				that.compute();
73  
-				that.plot();
74  
-				that.busy = false;
75  
-			}
76  
-		}
77  
-	};
78  
-	// prune tree
79  
-	if (config.levelsToShow > 0)
80  
-		tm.geom.setRightLevelToShow(parent);
81  
-	// animate node positions
  36
+	tm.out(node);	
82 37
 	pushNodeName(node);
83  
-	if (config.animate) {
84  
-		tm.clickedNode = clickedNode;
85  
-		tm.compute('end');
86  
-		// animate the visible subtree only
87  
-		tm.clickedNode = previousClickedNode;
88  
-		tm.fx.animate({
89  
-			modes : [ 'linear', 'node-property:width:height' ],
90  
-			duration : 1000,
91  
-			onComplete : function() {
92  
-				// animate the parent subtree
93  
-				that.clickedNode = clickedNode;
94  
-				// change nodes alpha
95  
-				graph.eachNode(function(n) {
96  
-					n.setDataset([ 'current', 'end' ], {
97  
-						'alpha' : [ 0, 1 ]
98  
-					});
99  
-				}, "ignore");
100  
-				previousClickedNode.eachSubgraph(function(node) {
101  
-					node.setData('alpha', 1);
102  
-				}, "ignore");
103  
-				that.fx.animate({
104  
-					duration : 500,
105  
-					modes : [ 'node-property:alpha' ],
106  
-					onComplete : function() {
107  
-						callback.onComplete();
108  
-					}
109  
-				});
110  
-			}
111  
-		});
112  
-	} else {
113  
-		callback.onComplete();
114  
-	}
115 38
 }
116 39
 function pushNodeName(node) {
117 40
 	var names = "";

0 notes on commit 0d4cf16

Please sign in to comment.
Something went wrong with that request. Please try again.