diff --git a/src/git.js b/src/git.js index 403b7edd..f5512ac1 100644 --- a/src/git.js +++ b/src/git.js @@ -22,8 +22,6 @@ function GitEngine(options) { this.generalArgs = []; events.on('processCommand', _.bind(this.dispatch, this)); - - this.init(); } GitEngine.prototype.init = function() { diff --git a/src/index.html b/src/index.html index a91e1a7b..13bf2313 100644 --- a/src/index.html +++ b/src/index.html @@ -128,8 +128,6 @@ - - @@ -152,5 +150,7 @@ + + diff --git a/src/main.js b/src/main.js index d5ede878..0eaa3a0d 100644 --- a/src/main.js +++ b/src/main.js @@ -3,18 +3,14 @@ */ var events = _.clone(Backbone.Events); -var gitEngine = null; -var gitVisuals = null; - -var commandCollection = null; -var commandBuffer = null; -var animationFactory = null; +var ui = null; +var animationFactory = new AnimationFactory(); var paper = null; $(document).ready(function(){ - initUI(); - var mainVis = new Visualization({ + ui = new UI(); + mainVis = new Visualization({ el: $('#canvasWrapper')[0] }); @@ -25,22 +21,21 @@ $(document).ready(function(){ } }); -function initUI() { +function UI() { // static classes - animationFactory = new AnimationFactory(); - commandCollection = new CommandCollection(); + this.commandCollection = new CommandCollection(); - commandBuffer = new CommandBuffer({ - collection: commandCollection + this.commandBuffer = new CommandBuffer({ + collection: this.commandCollection }); - commandPromptView = new CommandPromptView({ + this.commandPromptView = new CommandPromptView({ el: $('#commandLineBar'), - collection: commandCollection + collection: this.commandCollection }); - commandLineHistoryView = new CommandLineHistoryView({ + this.commandLineHistoryView = new CommandLineHistoryView({ el: $('#commandLineHistory'), - collection: commandCollection + collection: this.commandCollection }); $('#commandTextField').focus(); diff --git a/src/visuals.js b/src/visuals.js index aa146ca5..8570e95b 100644 --- a/src/visuals.js +++ b/src/visuals.js @@ -25,15 +25,18 @@ var Visualization = Backbone.View.extend({ branches: this.branchCollection, gitVisuals: this.gitVisuals }); + this.gitEngine.init(); this.gitVisuals.assignGitEngine(this.gitEngine); // needs to be called before raphael ready this.myResize(); + $(window).on('resize', _.bind(this.myResize, this)); + this.gitVisuals.drawTreeFirstTime(); }, myResize: function() { - var smaller = 10; + var smaller = 1; var el = this.el; var left = el.offsetLeft;