mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 17:27:22 +02:00
sliding in and out
This commit is contained in:
parent
e06a7efbfc
commit
b945037f34
5 changed files with 128 additions and 21 deletions
|
@ -34,7 +34,7 @@ var Level = Sandbox.extend({
|
|||
this.goalTreeString = options.level.goalTree;
|
||||
if (!this.goalTreeString) {
|
||||
console.warn('woah no goal, using random other one');
|
||||
this.goalTreeString = '{"branches":{"master":{"target":"C2","id":"master"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C30"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"}}';
|
||||
this.goalTreeString = '{"branches":{"master":{"target":"C2","id":"master"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"}}';
|
||||
//this.goalTreeString = '{"branches":{"master":{"target":"C2","id":"master"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"master","id":"HEAD"}}';
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,21 @@ var Level = Sandbox.extend({
|
|||
el: options.el || this.getDefaultVisEl(),
|
||||
treeString: options.level.startTree
|
||||
});
|
||||
|
||||
//this.initGoalVisualization(options);
|
||||
},
|
||||
|
||||
getDefaultGoalVisEl: function() {
|
||||
return $('#commandLineHistory');
|
||||
},
|
||||
|
||||
initGoalVisualization: function(options) {
|
||||
this.goalVisualization = new Visualization({
|
||||
el: options.goalEl || this.getDefaultGoalVisEl(),
|
||||
treeString: this.goalTreeString,
|
||||
wait: true,
|
||||
slideOut: true
|
||||
});
|
||||
},
|
||||
|
||||
initParseWaterfall: function(options) {
|
||||
|
|
|
@ -54,12 +54,6 @@ var Sandbox = Backbone.View.extend({
|
|||
},
|
||||
|
||||
initGitShim: function(options) {
|
||||
/*
|
||||
this.gitShim = new GitShim({
|
||||
beforeCB: function() { console.log('before'); },
|
||||
afterCB: function() { console.log('after'); },
|
||||
afterDeferHandler: function(deferred) { deferred.resolve(); },
|
||||
});*/
|
||||
},
|
||||
|
||||
takeControl: function() {
|
||||
|
|
|
@ -64,6 +64,9 @@ var Visualization = Backbone.View.extend({
|
|||
if (!options.wait) {
|
||||
this.fadeTreeIn();
|
||||
}
|
||||
if (options.slideOut) {
|
||||
this.slideOut();
|
||||
}
|
||||
|
||||
this.customEvents.trigger('gitEngineReady');
|
||||
},
|
||||
|
@ -76,6 +79,28 @@ var Visualization = Backbone.View.extend({
|
|||
$(this.paper.canvas).css('opacity', 0);
|
||||
},
|
||||
|
||||
slideOut: function() {
|
||||
this.toggleSlide(true);
|
||||
},
|
||||
|
||||
slideIn: function() {
|
||||
this.toggleSlide(false);
|
||||
},
|
||||
|
||||
toggleSlide: function(value) {
|
||||
// no classes on svg :-/
|
||||
//$(this.paper.canvas).toggleClass('slideOut', value);
|
||||
var transform = (value) ? 'translate3d(-150%, 0, 0)' : 'translate3d(0,0,0)';
|
||||
|
||||
$(this.paper.canvas).css({
|
||||
'-webkit-transform': transform,
|
||||
'-moz-transform': transform,
|
||||
'-ms-transform': transform,
|
||||
'-o-transform': transform,
|
||||
'transform': transform
|
||||
});
|
||||
},
|
||||
|
||||
getAnimationTime: function() { return 300; },
|
||||
|
||||
fadeTreeIn: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue