Make sure that we only save the tree reference if we have actually rendered it (properly this time, since apparently d3 will append to.. nothing…)
This commit is contained in:
parent
8da4104e7b
commit
e336185a22
1 changed files with 6 additions and 11 deletions
|
@ -186,6 +186,11 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
// Save the container.
|
||||
this.container_ = container;
|
||||
|
||||
if (!$('#' + container)[0]) {
|
||||
this.container_ = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the tree and all its components.
|
||||
var tree = d3.layout.tree()
|
||||
.separation(function() { return 2; });
|
||||
|
@ -193,20 +198,10 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
var diagonal = d3.svg.diagonal()
|
||||
.projection(function(d) { return [d.x, d.y]; });
|
||||
|
||||
var rootSvg = d3.select("#" + container).append("svg:svg")
|
||||
var rootSvg = d3.select("#" + container).append("svg:svg")
|
||||
.attr("class", "image-tree");
|
||||
|
||||
if (!rootSvg) {
|
||||
this.container_ = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var vis = rootSvg.append("svg:g");
|
||||
if (!vis) {
|
||||
this.container_ = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var formatComment = this.formatComment_;
|
||||
var formatTime = this.formatTime_;
|
||||
var formatCommand = this.formatCommand_;
|
||||
|
|
Reference in a new issue