Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing problem described in issue #34

  • Loading branch information...
commit 0d4cf16469721761231783267179c1182f760b23 1 parent b795a83
Mathieu Poignet authored
View
20 src/main/resources/webapp/js/jit.js
@@ -14984,8 +14984,9 @@ TM.Base = {
Sets the parent node of the current selected node as root.
*/
- out: function(){
- if(this.busy) return;
+ out: function(node){
+
+ if(this.busy && !node) return;
this.busy = true;
this.events.hoveredNode = false;
var that = this,
@@ -14997,6 +14998,7 @@ TM.Base = {
clickedNode = parent,
previousClickedNode = this.clickedNode;
+
//if no parents return
if(!parent) {
this.busy = false;
@@ -15009,9 +15011,14 @@ TM.Base = {
if(config.request) {
that.requestNodes(parent, {
onComplete: function() {
- that.compute();
- that.plot();
- that.busy = false;
+ if(node && clickedNode!=node){
+ that.out(node);
+ that.busy = false;
+ }else{
+ that.compute();
+ that.plot();
+ that.busy = false;
+ }
}
});
} else {
@@ -15025,7 +15032,8 @@ TM.Base = {
if (config.levelsToShow > 0)
this.geom.setRightLevelToShow(parent);
//animate node positions
- if(config.animate) {
+ if((config.animate && !node) || (config.animate && clickedNode==node)) {
+ console.log("animate");
this.clickedNode = clickedNode;
this.compute('end');
//animate the visible subtree only
View
79 src/main/resources/webapp/js/treemap.js
@@ -33,85 +33,8 @@ var JsonB;
function goToNode(nodeId) {
var node = tm.graph.getNode(nodeId);
-
- if (tm.busy)
- return;
- tm.busy = true;
- tm.events.hoveredNode = false;
- if (nodeId == tm.root) {
- var that = tm,
- config = tm.config,
- graph = tm.graph,
- parents = node.getParents(),
- parent = node,
- clickedNode = node,
- previousClickedNode = tm.clickedNode;
- } else {
- var that = tm,
- config = tm.config,
- graph = tm.graph,
- parents = node.getParents(),
- parent = parents[0],
- clickedNode = parent,
- previousClickedNode = tm.clickedNode;
- }
-
- // final plot callback
- callback = {
- onComplete : function() {
- that.clickedNode = parent;
- if (config.request) {
- that.requestNodes(parent, {
- onComplete : function() {
- that.compute();
- that.plot();
- that.busy = false;
- }
- });
- } else {
- that.compute();
- that.plot();
- that.busy = false;
- }
- }
- };
- // prune tree
- if (config.levelsToShow > 0)
- tm.geom.setRightLevelToShow(parent);
- // animate node positions
+ tm.out(node);
pushNodeName(node);
- if (config.animate) {
- tm.clickedNode = clickedNode;
- tm.compute('end');
- // animate the visible subtree only
- tm.clickedNode = previousClickedNode;
- tm.fx.animate({
- modes : [ 'linear', 'node-property:width:height' ],
- duration : 1000,
- onComplete : function() {
- // animate the parent subtree
- that.clickedNode = clickedNode;
- // change nodes alpha
- graph.eachNode(function(n) {
- n.setDataset([ 'current', 'end' ], {
- 'alpha' : [ 0, 1 ]
- });
- }, "ignore");
- previousClickedNode.eachSubgraph(function(node) {
- node.setData('alpha', 1);
- }, "ignore");
- that.fx.animate({
- duration : 500,
- modes : [ 'node-property:alpha' ],
- onComplete : function() {
- callback.onComplete();
- }
- });
- }
- });
- } else {
- callback.onComplete();
- }
}
function pushNodeName(node) {
var names = "";
Please sign in to comment.
Something went wrong with that request. Please try again.