mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
better show and hide for goal and start visualizations related to Issue #36 nice
This commit is contained in:
parent
902944d53a
commit
e8dd24fa5c
7 changed files with 108 additions and 147 deletions
|
@ -149,12 +149,7 @@ var Level = Sandbox.extend({
|
|||
noKeyboardInput: true,
|
||||
noClick: true
|
||||
});
|
||||
},
|
||||
|
||||
onGoalVisualizationClick: function() {
|
||||
// we need to destory this entire view whenever it is hidden so the scroll bar
|
||||
// still works. unfortunately this
|
||||
delete this.goalCanvasHolder;
|
||||
return this.goalCanvasHolder;
|
||||
},
|
||||
|
||||
showSolution: function(command, deferred) {
|
||||
|
@ -201,24 +196,36 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
showGoal: function(command, defer) {
|
||||
if (!this.goalCanvasHolder || !this.goalCanvasHolder.inDom) {
|
||||
this.initGoalVisualization();
|
||||
}
|
||||
this.goalCanvasHolder.slideIn();
|
||||
this.showSideVis(command, defer, this.goalCanvasHolder, this.initGoalVisualization);
|
||||
},
|
||||
|
||||
if (!command || !defer) { return; }
|
||||
setTimeout(function() {
|
||||
command.finishWith(defer);
|
||||
}, this.goalCanvasHolder.getAnimationTime());
|
||||
showSideVis: function(command, defer, canvasHolder, initMethod) {
|
||||
var safeFinish = function() {
|
||||
if (command) { command.finishWith(defer); }
|
||||
};
|
||||
if (!canvasHolder || !canvasHolder.inDom) {
|
||||
canvasHolder = initMethod.apply(this);
|
||||
}
|
||||
|
||||
canvasHolder.slideIn();
|
||||
setTimeout(safeFinish, canvasHolder.getAnimationTime());
|
||||
},
|
||||
|
||||
hideGoal: function(command, defer) {
|
||||
this.goalCanvasHolder.die();
|
||||
if (!command || !defer) { return; }
|
||||
this.hideSideVis(command, defer, this.goalCanvasHolder);
|
||||
},
|
||||
|
||||
setTimeout(function() {
|
||||
command.finishWith(defer);
|
||||
}, this.goalCanvasHolder.getAnimationTime());
|
||||
hideSideVis: function(command, defer, canvasHolder, vis) {
|
||||
var safeFinish = function() {
|
||||
if (command) { command.finishWith(defer); }
|
||||
};
|
||||
|
||||
if (canvasHolder && canvasHolder.inDom) {
|
||||
canvasHolder.die();
|
||||
setTimeout(safeFinish, canvasHolder.getAnimationTime());
|
||||
} else {
|
||||
safeFinish();
|
||||
}
|
||||
},
|
||||
|
||||
initParseWaterfall: function(options) {
|
||||
|
@ -383,7 +390,7 @@ var Level = Sandbox.extend({
|
|||
die: function() {
|
||||
this.levelToolbar.die();
|
||||
|
||||
this.goalDie();
|
||||
this.hideGoal();
|
||||
this.mainVis.die();
|
||||
this.releaseControl();
|
||||
|
||||
|
@ -395,11 +402,6 @@ var Level = Sandbox.extend({
|
|||
delete this.goalCanvasHolder;
|
||||
},
|
||||
|
||||
goalDie: function() {
|
||||
this.goalCanvasHolder.die();
|
||||
this.goalVis.die();
|
||||
},
|
||||
|
||||
getInstantCommands: function() {
|
||||
var hintMsg = (this.level.hint) ?
|
||||
this.level.hint :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue