ok demonstraton view coming along

This commit is contained in:
Peter Cottle 2013-01-06 17:25:43 -08:00
parent c1813c346c
commit c5615fe15a
10 changed files with 444 additions and 64 deletions

View file

@ -615,9 +615,14 @@ GitVisuals.prototype.animateEdges = function(speed) {
}, this);
};
GitVisuals.prototype.getMinLayers = function() {
return (this.options.smallCanvas) ? 4 : 7;
};
GitVisuals.prototype.getDepthIncrement = function(maxDepth) {
// assume there are at least 7 layers until later
maxDepth = Math.max(maxDepth, 7);
// assume there are at least a number of layers until later
// to have better visuals
maxDepth = Math.max(maxDepth, this.getMinLayers());
var increment = 1.0 / maxDepth;
return increment;
};

View file

@ -48,7 +48,8 @@ var Visualization = Backbone.View.extend({
commitCollection: this.commitCollection,
branchCollection: this.branchCollection,
paper: this.paper,
noClick: this.options.noClick
noClick: this.options.noClick,
smallCanvas: this.options.smallCanvas
});
var GitEngine = require('../git').GitEngine;
@ -68,22 +69,26 @@ var Visualization = Backbone.View.extend({
}, this));
this.gitVisuals.drawTreeFirstTime();
if (this.treeString) {
this.gitEngine.loadTreeFromString(this.treeString);
}
if (this.options.zIndex) {
this.setTreeIndex(this.options.zIndex);
}
this.shown = false;
this.setTreeOpacity(0);
// reflow needed
process.nextTick(_.bind(function() {
this.fadeTreeIn();
}, this));
process.nextTick(_.bind(this.fadeTreeIn, this));
this.customEvents.trigger('gitEngineReady');
this.customEvents.trigger('paperReady');
},
setTreeIndex: function(level) {
$(this.paper.canvas).css('z-index', level);
},
setTreeOpacity: function(level) {
if (level === 0) {
this.shown = false;
@ -114,9 +119,12 @@ var Visualization = Backbone.View.extend({
show: function() {
$(this.paper.canvas).css('visibility', 'visible');
process.nextTick(_.bind(function() {
this.fadeTreeIn();
}, this));
setTimeout(_.bind(this.fadeTreeIn, this), 10);
},
showHarsh: function() {
$(this.paper.canvas).css('visibility', 'visible');
this.setTreeOpacity(1);
},
reset: function() {