implemented clear canvas too... sort of

This commit is contained in:
Devin Howard 2013-02-14 21:58:55 -05:00
parent 35dd8c1816
commit e762be0be3

View file

@ -163,14 +163,34 @@ function onCanvasSearch(name,mapID,mapperID) {
});
}
function clearCanvas() {
Mconsole.graph.eachNode( function(n) { Mconsole.graph.removeNode(n.id); Mconsole.labels.disposeLabel(n.id); });
Mconsole.plot();
Mconsole.graph.eachNode(function(n) {
Mconsole.graph.removeNode(n.id);
Mconsole.labels.disposeLabel(n.id);
});
Mconsole.plot();
}
function clearCanvasExceptRoot() {
var ids = new Array();
Mconsole.graph.eachNode(function(n) {
ids.push(n.id);
});
var root = Mconsole.graph.nodes[Mconsole.root];
ids.forEach(function(id, index) {
if (id != root.id) {
Mconsole.graph.removeNode(id);
//OK I feel bad about this, but not too bad
//TODO: this leaves labels hidden on the map
Mconsole.labels.hideLabel(id);
}
});
fetchRelatives(root); //also runs Mconsole.plot()
}
function clearFoundData() {
Mconsole.graph.eachNode( function(n) {
Mconsole.graph.eachNode( function(n) {
if (n.getData('inCommons') === true) {
Mconsole.graph.removeNode(n.id);
Mconsole.labels.disposeLabel(n.id);
@ -557,4 +577,4 @@ function closeFind() {
width: '45px',
height: '32px'
}, 100);
}
}