Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ ENV/
/site

# mypy
.mypy_cache/
.mypy_cache/
.vscode
2 changes: 1 addition & 1 deletion static/js/tree/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ D3MSTreeContextMenu.prototype._init=function(){
});

$("#collapse_node").click(function(e) {
self.tree.collapseSpecificNodes(self.tree.getSelectedNodeIDs());
self.tree.collapseSpecificNodes(self.tree.getSelectedNodeIDs(), false);
});
$("#delete-node").click(function(e) {
self.tree.delNodes(self.tree.getSelectedNodeIDs());
Expand Down
17 changes: 9 additions & 8 deletions static/js/tree/d3_m_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ D3MSTree.prototype.collapseNodes= function(max_distance,keep_current_layout){
for (var i in this.force_nodes){
var node=this.force_nodes[i];
layout[node.id] = [node.x,node.y];
}
}
}
layout = this._collapseNodes(max_distance, layout, ! keep_current_layout);

Expand All @@ -444,7 +444,7 @@ D3MSTree.prototype.collapseNodes= function(max_distance,keep_current_layout){
}

D3MSTree.prototype._collapseNodes=function(max_distance,layout, redraw){
var self = this;
var self = this;
if (this.original_links.length > 50000) {
this.original_links.sort(function(n1, n2) {return n2.distance-n1.distance});
}
Expand Down Expand Up @@ -487,7 +487,7 @@ D3MSTree.prototype._collapseNodes=function(max_distance,layout, redraw){
});
}
var to_collapse = JSON.parse(JSON.stringify(this.manual_collapsing));
this.manual_collapsing_value = Object.keys(this.manual_collapsing).length;
this.manual_collapsing_value = Object.keys(this.manual_collapsing).length;
if (this.manual_collapsing_value > 0) {
var collapsed = 1;
while (collapsed) {
Expand All @@ -496,16 +496,16 @@ D3MSTree.prototype._collapseNodes=function(max_distance,layout, redraw){
var s_c = to_collapse[link.source.id] ? to_collapse[link.source.id] : 0;
var t_c = to_collapse[link.target.id] ? to_collapse[link.target.id] : 0;
if (s_c > t_c) {
to_collapse[link.target.id] = s_c;
collapsed = 1;
to_collapse[link.target.id] = s_c;
collapsed = 1;
}
});
}
}

var valid_label = {};
for (var index=this.force_links.length-1; index >=0; index --) {
var l = this.force_links[index];
var l = this.force_links[index];
if ( !l || (l.value > max_distance && to_collapse[l.source.id] !== 2) || (l.value && to_collapse[l.source.id] === 1) ) continue;
if (l.source.hypothetical && ! valid_label[l.source.id]) {
if (! l.target.hypothetical) {
Expand All @@ -514,7 +514,7 @@ D3MSTree.prototype._collapseNodes=function(max_distance,layout, redraw){
valid_label[l.source.id] = valid_label[l.target.id];
}
}
this.hypo_record[l.target.id] = l.source.id;
this.hypo_record[l.target.id] = l.source.id;
}
for (var t_id in this.hypo_record) {
var src_id = this.hypo_record[t_id];
Expand Down Expand Up @@ -906,8 +906,9 @@ D3MSTree.prototype.toggleHypotheticalNodes=function(){

D3MSTree.prototype.collapseSpecificNodes=function(nodes,uncollapse){
var val = uncollapse?1:2
var self = this;
for (var i in nodes) {
var node=nodes[i];
var node=nodes[i];
Object.keys(this.hypo_record).filter(function(k) {
return self.hypo_record[k] == node;
}).forEach(function(k) {
Expand Down