mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
NICEEEeee have visualization function doing resizes
This commit is contained in:
parent
e412be9b61
commit
faa3a11434
2 changed files with 19 additions and 21 deletions
20
src/main.js
20
src/main.js
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue