NICEEEeee have visualization function doing resizes

This commit is contained in:
Peter Cottle 2012-11-03 13:57:08 -07:00
parent e412be9b61
commit faa3a11434
2 changed files with 19 additions and 21 deletions

View file

@ -18,7 +18,6 @@ $(document).ready(function(){
el: $('#canvasWrapper')[0]
});
// make the canvas for us
if (/\?demo/.test(window.location.href)) {
setTimeout(function() {
events.trigger('submitCommandValueFromEvent', "gc; git checkout HEAD~1; git commit; git checkout -b bugFix; gc; gc; git rebase master; git checkout master; gc; gc; git merge bugFix");
@ -47,22 +46,3 @@ function initUI() {
$('#commandTextField').focus();
}
function windowResize() {
var smaller = 10;
var el = $('#canvasWrapper')[0];
var left = el.offsetLeft;
var top = el.offsetTop;
var width = el.clientWidth - smaller;
var height = el.clientHeight - smaller;
if (paper && paper.canvas) {
$(paper.canvas).css({
left: left + 'px',
top: top + 'px'
});
paper.setSize(width, height);
}
events.trigger('canvasResize', width, height);
}

View file

@ -11,6 +11,7 @@ var Visualization = Backbone.View.extend({
},
paperInitialize: function(paper, options) {
this.paper = paper;
this.commitCollection = new CommitCollection();
this.branchCollection = new BranchCollection();
@ -25,8 +26,25 @@ var Visualization = Backbone.View.extend({
});
// needs to be called before raphael ready
windowResize();
this.myResize();
events.trigger('raphaelReady');
},
myResize: function() {
var smaller = 10;
var el = this.el;
var left = el.offsetLeft;
var top = el.offsetTop;
var width = el.clientWidth - smaller;
var height = el.clientHeight - smaller;
$(this.paper.canvas).css({
left: left + 'px',
top: top + 'px'
});
paper.setSize(width, height);
events.trigger('canvasResize', width, height);
}
});