better show and hide for goal and start visualizations related to Issue #36 nice

This commit is contained in:
Peter Cottle 2013-02-18 14:19:30 -08:00
parent 902944d53a
commit e8dd24fa5c
7 changed files with 108 additions and 147 deletions

View file

@ -6809,12 +6809,7 @@ var Level = Sandbox.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.goalCanvasHolder;
onGoalVisualizationClick: function() {
// we need to destory this entire view whenever it is hidden so the scroll bar
// still works. unfortunately this
delete this.goalCanvasHolder;
}, },
showSolution: function(command, deferred) { showSolution: function(command, deferred) {
@ -6861,24 +6856,36 @@ var Level = Sandbox.extend({
}, },
showGoal: function(command, defer) { showGoal: function(command, defer) {
if (!this.goalCanvasHolder || !this.goalCanvasHolder.inDom) { this.showSideVis(command, defer, this.goalCanvasHolder, this.initGoalVisualization);
this.initGoalVisualization(); },
}
this.goalCanvasHolder.slideIn();
if (!command || !defer) { return; } showSideVis: function(command, defer, canvasHolder, initMethod) {
setTimeout(function() { var safeFinish = function() {
command.finishWith(defer); if (command) { command.finishWith(defer); }
}, this.goalCanvasHolder.getAnimationTime()); };
if (!canvasHolder || !canvasHolder.inDom) {
canvasHolder = initMethod.apply(this);
}
canvasHolder.slideIn();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
}, },
hideGoal: function(command, defer) { hideGoal: function(command, defer) {
this.goalCanvasHolder.die(); this.hideSideVis(command, defer, this.goalCanvasHolder);
if (!command || !defer) { return; } },
setTimeout(function() { hideSideVis: function(command, defer, canvasHolder, vis) {
command.finishWith(defer); var safeFinish = function() {
}, this.goalCanvasHolder.getAnimationTime()); if (command) { command.finishWith(defer); }
};
if (canvasHolder && canvasHolder.inDom) {
canvasHolder.die();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
} else {
safeFinish();
}
}, },
initParseWaterfall: function(options) { initParseWaterfall: function(options) {
@ -7043,7 +7050,7 @@ var Level = Sandbox.extend({
die: function() { die: function() {
this.levelToolbar.die(); this.levelToolbar.die();
this.goalDie(); this.hideGoal();
this.mainVis.die(); this.mainVis.die();
this.releaseControl(); this.releaseControl();
@ -7055,11 +7062,6 @@ var Level = Sandbox.extend({
delete this.goalCanvasHolder; delete this.goalCanvasHolder;
}, },
goalDie: function() {
this.goalCanvasHolder.die();
this.goalVis.die();
},
getInstantCommands: function() { getInstantCommands: function() {
var hintMsg = (this.level.hint) ? var hintMsg = (this.level.hint) ?
this.level.hint : this.level.hint :
@ -13499,7 +13501,6 @@ var LevelBuilder = Level.extend({
}; };
LevelBuilder.__super__.initialize.apply(this, [options]); LevelBuilder.__super__.initialize.apply(this, [options]);
this.initStartVisualization();
this.startDialog = undefined; this.startDialog = undefined;
this.definedGoal = false; this.definedGoal = false;
@ -13535,11 +13536,7 @@ var LevelBuilder = Level.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.startCanvasHolder;
startDie: function() {
this.startCanvasHolder.die();
this.startVis.die();
}, },
startOffCommand: function() { startOffCommand: function() {
@ -13595,17 +13592,13 @@ var LevelBuilder = Level.extend({
}, },
showGoal: function() { showGoal: function() {
this.startCanvasHolder.slideOut(); this.hideStart();
LevelBuilder.__super__.showGoal.apply(this, arguments); LevelBuilder.__super__.showGoal.apply(this, arguments);
}, },
showStart: function(command, deferred) { showStart: function(command, deferred) {
this.goalCanvasHolder.slideOut(); this.hideGoal();
this.startCanvasHolder.slideIn(); this.showSideVis(command, deferred, this.startCanvasHolder, this.initStartVisualization);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
resetSolution: function() { resetSolution: function() {
@ -13614,15 +13607,11 @@ var LevelBuilder = Level.extend({
}, },
hideStart: function(command, deferred) { hideStart: function(command, deferred) {
this.startCanvasHolder.slideOut(); this.hideSideVis(command, deferred, this.startCanvasHolder);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
defineStart: function(command, deferred) { defineStart: function(command, deferred) {
this.startDie(); this.hideStart();
command.addWarning( command.addWarning(
'Defining start point... solution and goal will be overwritten if they were defined earlier' 'Defining start point... solution and goal will be overwritten if they were defined earlier'
@ -13632,13 +13621,11 @@ var LevelBuilder = Level.extend({
this.level.startTree = this.mainVis.gitEngine.printTree(); this.level.startTree = this.mainVis.gitEngine.printTree();
this.mainVis.resetFromThisTreeNow(this.level.startTree); this.mainVis.resetFromThisTreeNow(this.level.startTree);
this.initStartVisualization();
this.showStart(command, deferred); this.showStart(command, deferred);
}, },
defineGoal: function(command, deferred) { defineGoal: function(command, deferred) {
this.goalDie(); this.hideGoal();
if (!this.gitCommandsIssued.length) { if (!this.gitCommandsIssued.length) {
command.set('error', new Errors.GitError({ command.set('error', new Errors.GitError({
@ -13803,7 +13790,7 @@ var LevelBuilder = Level.extend({
}, },
die: function() { die: function() {
this.startDie(); this.hideStart();
LevelBuilder.__super__.die.apply(this, arguments); LevelBuilder.__super__.die.apply(this, arguments);
@ -21415,7 +21402,6 @@ var LevelBuilder = Level.extend({
}; };
LevelBuilder.__super__.initialize.apply(this, [options]); LevelBuilder.__super__.initialize.apply(this, [options]);
this.initStartVisualization();
this.startDialog = undefined; this.startDialog = undefined;
this.definedGoal = false; this.definedGoal = false;
@ -21451,11 +21437,7 @@ var LevelBuilder = Level.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.startCanvasHolder;
startDie: function() {
this.startCanvasHolder.die();
this.startVis.die();
}, },
startOffCommand: function() { startOffCommand: function() {
@ -21511,17 +21493,13 @@ var LevelBuilder = Level.extend({
}, },
showGoal: function() { showGoal: function() {
this.startCanvasHolder.slideOut(); this.hideStart();
LevelBuilder.__super__.showGoal.apply(this, arguments); LevelBuilder.__super__.showGoal.apply(this, arguments);
}, },
showStart: function(command, deferred) { showStart: function(command, deferred) {
this.goalCanvasHolder.slideOut(); this.hideGoal();
this.startCanvasHolder.slideIn(); this.showSideVis(command, deferred, this.startCanvasHolder, this.initStartVisualization);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
resetSolution: function() { resetSolution: function() {
@ -21530,15 +21508,11 @@ var LevelBuilder = Level.extend({
}, },
hideStart: function(command, deferred) { hideStart: function(command, deferred) {
this.startCanvasHolder.slideOut(); this.hideSideVis(command, deferred, this.startCanvasHolder);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
defineStart: function(command, deferred) { defineStart: function(command, deferred) {
this.startDie(); this.hideStart();
command.addWarning( command.addWarning(
'Defining start point... solution and goal will be overwritten if they were defined earlier' 'Defining start point... solution and goal will be overwritten if they were defined earlier'
@ -21548,13 +21522,11 @@ var LevelBuilder = Level.extend({
this.level.startTree = this.mainVis.gitEngine.printTree(); this.level.startTree = this.mainVis.gitEngine.printTree();
this.mainVis.resetFromThisTreeNow(this.level.startTree); this.mainVis.resetFromThisTreeNow(this.level.startTree);
this.initStartVisualization();
this.showStart(command, deferred); this.showStart(command, deferred);
}, },
defineGoal: function(command, deferred) { defineGoal: function(command, deferred) {
this.goalDie(); this.hideGoal();
if (!this.gitCommandsIssued.length) { if (!this.gitCommandsIssued.length) {
command.set('error', new Errors.GitError({ command.set('error', new Errors.GitError({
@ -21719,7 +21691,7 @@ var LevelBuilder = Level.extend({
}, },
die: function() { die: function() {
this.startDie(); this.hideStart();
LevelBuilder.__super__.die.apply(this, arguments); LevelBuilder.__super__.die.apply(this, arguments);
@ -21928,12 +21900,7 @@ var Level = Sandbox.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.goalCanvasHolder;
onGoalVisualizationClick: function() {
// we need to destory this entire view whenever it is hidden so the scroll bar
// still works. unfortunately this
delete this.goalCanvasHolder;
}, },
showSolution: function(command, deferred) { showSolution: function(command, deferred) {
@ -21980,24 +21947,36 @@ var Level = Sandbox.extend({
}, },
showGoal: function(command, defer) { showGoal: function(command, defer) {
if (!this.goalCanvasHolder || !this.goalCanvasHolder.inDom) { this.showSideVis(command, defer, this.goalCanvasHolder, this.initGoalVisualization);
this.initGoalVisualization(); },
}
this.goalCanvasHolder.slideIn();
if (!command || !defer) { return; } showSideVis: function(command, defer, canvasHolder, initMethod) {
setTimeout(function() { var safeFinish = function() {
command.finishWith(defer); if (command) { command.finishWith(defer); }
}, this.goalCanvasHolder.getAnimationTime()); };
if (!canvasHolder || !canvasHolder.inDom) {
canvasHolder = initMethod.apply(this);
}
canvasHolder.slideIn();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
}, },
hideGoal: function(command, defer) { hideGoal: function(command, defer) {
this.goalCanvasHolder.die(); this.hideSideVis(command, defer, this.goalCanvasHolder);
if (!command || !defer) { return; } },
setTimeout(function() { hideSideVis: function(command, defer, canvasHolder, vis) {
command.finishWith(defer); var safeFinish = function() {
}, this.goalCanvasHolder.getAnimationTime()); if (command) { command.finishWith(defer); }
};
if (canvasHolder && canvasHolder.inDom) {
canvasHolder.die();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
} else {
safeFinish();
}
}, },
initParseWaterfall: function(options) { initParseWaterfall: function(options) {
@ -22162,7 +22141,7 @@ var Level = Sandbox.extend({
die: function() { die: function() {
this.levelToolbar.die(); this.levelToolbar.die();
this.goalDie(); this.hideGoal();
this.mainVis.die(); this.mainVis.die();
this.releaseControl(); this.releaseControl();
@ -22174,11 +22153,6 @@ var Level = Sandbox.extend({
delete this.goalCanvasHolder; delete this.goalCanvasHolder;
}, },
goalDie: function() {
this.goalCanvasHolder.die();
this.goalVis.die();
},
getInstantCommands: function() { getInstantCommands: function() {
var hintMsg = (this.level.hint) ? var hintMsg = (this.level.hint) ?
this.level.hint : this.level.hint :

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -409,7 +409,7 @@
For a much easier time perusing the source, see the individual files at: For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching https://github.com/pcottle/learnGitBranching
--> -->
<script src="build/bundle.min.51f92e48.js"></script> <script src="build/bundle.min.ff85065c.js"></script>
<!-- The advantage of github pages: super-easy, simple, slick static hostic. <!-- The advantage of github pages: super-easy, simple, slick static hostic.
The downside? No raw logs to parse for analytics, so I have to include The downside? No raw logs to parse for analytics, so I have to include

View file

@ -48,7 +48,6 @@ var LevelBuilder = Level.extend({
}; };
LevelBuilder.__super__.initialize.apply(this, [options]); LevelBuilder.__super__.initialize.apply(this, [options]);
this.initStartVisualization();
this.startDialog = undefined; this.startDialog = undefined;
this.definedGoal = false; this.definedGoal = false;
@ -84,11 +83,7 @@ var LevelBuilder = Level.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.startCanvasHolder;
startDie: function() {
this.startCanvasHolder.die();
this.startVis.die();
}, },
startOffCommand: function() { startOffCommand: function() {
@ -144,17 +139,13 @@ var LevelBuilder = Level.extend({
}, },
showGoal: function() { showGoal: function() {
this.startCanvasHolder.slideOut(); this.hideStart();
LevelBuilder.__super__.showGoal.apply(this, arguments); LevelBuilder.__super__.showGoal.apply(this, arguments);
}, },
showStart: function(command, deferred) { showStart: function(command, deferred) {
this.goalCanvasHolder.slideOut(); this.hideGoal();
this.startCanvasHolder.slideIn(); this.showSideVis(command, deferred, this.startCanvasHolder, this.initStartVisualization);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
resetSolution: function() { resetSolution: function() {
@ -163,15 +154,11 @@ var LevelBuilder = Level.extend({
}, },
hideStart: function(command, deferred) { hideStart: function(command, deferred) {
this.startCanvasHolder.slideOut(); this.hideSideVis(command, deferred, this.startCanvasHolder);
setTimeout(function() {
command.finishWith(deferred);
}, this.startCanvasHolder.getAnimationTime());
}, },
defineStart: function(command, deferred) { defineStart: function(command, deferred) {
this.startDie(); this.hideStart();
command.addWarning( command.addWarning(
'Defining start point... solution and goal will be overwritten if they were defined earlier' 'Defining start point... solution and goal will be overwritten if they were defined earlier'
@ -181,13 +168,11 @@ var LevelBuilder = Level.extend({
this.level.startTree = this.mainVis.gitEngine.printTree(); this.level.startTree = this.mainVis.gitEngine.printTree();
this.mainVis.resetFromThisTreeNow(this.level.startTree); this.mainVis.resetFromThisTreeNow(this.level.startTree);
this.initStartVisualization();
this.showStart(command, deferred); this.showStart(command, deferred);
}, },
defineGoal: function(command, deferred) { defineGoal: function(command, deferred) {
this.goalDie(); this.hideGoal();
if (!this.gitCommandsIssued.length) { if (!this.gitCommandsIssued.length) {
command.set('error', new Errors.GitError({ command.set('error', new Errors.GitError({
@ -352,7 +337,7 @@ var LevelBuilder = Level.extend({
}, },
die: function() { die: function() {
this.startDie(); this.hideStart();
LevelBuilder.__super__.die.apply(this, arguments); LevelBuilder.__super__.die.apply(this, arguments);

View file

@ -149,12 +149,7 @@ var Level = Sandbox.extend({
noKeyboardInput: true, noKeyboardInput: true,
noClick: true noClick: true
}); });
}, return this.goalCanvasHolder;
onGoalVisualizationClick: function() {
// we need to destory this entire view whenever it is hidden so the scroll bar
// still works. unfortunately this
delete this.goalCanvasHolder;
}, },
showSolution: function(command, deferred) { showSolution: function(command, deferred) {
@ -201,24 +196,36 @@ var Level = Sandbox.extend({
}, },
showGoal: function(command, defer) { showGoal: function(command, defer) {
if (!this.goalCanvasHolder || !this.goalCanvasHolder.inDom) { this.showSideVis(command, defer, this.goalCanvasHolder, this.initGoalVisualization);
this.initGoalVisualization(); },
}
this.goalCanvasHolder.slideIn();
if (!command || !defer) { return; } showSideVis: function(command, defer, canvasHolder, initMethod) {
setTimeout(function() { var safeFinish = function() {
command.finishWith(defer); if (command) { command.finishWith(defer); }
}, this.goalCanvasHolder.getAnimationTime()); };
if (!canvasHolder || !canvasHolder.inDom) {
canvasHolder = initMethod.apply(this);
}
canvasHolder.slideIn();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
}, },
hideGoal: function(command, defer) { hideGoal: function(command, defer) {
this.goalCanvasHolder.die(); this.hideSideVis(command, defer, this.goalCanvasHolder);
if (!command || !defer) { return; } },
setTimeout(function() { hideSideVis: function(command, defer, canvasHolder, vis) {
command.finishWith(defer); var safeFinish = function() {
}, this.goalCanvasHolder.getAnimationTime()); if (command) { command.finishWith(defer); }
};
if (canvasHolder && canvasHolder.inDom) {
canvasHolder.die();
setTimeout(safeFinish, canvasHolder.getAnimationTime());
} else {
safeFinish();
}
}, },
initParseWaterfall: function(options) { initParseWaterfall: function(options) {
@ -383,7 +390,7 @@ var Level = Sandbox.extend({
die: function() { die: function() {
this.levelToolbar.die(); this.levelToolbar.die();
this.goalDie(); this.hideGoal();
this.mainVis.die(); this.mainVis.die();
this.releaseControl(); this.releaseControl();
@ -395,11 +402,6 @@ var Level = Sandbox.extend({
delete this.goalCanvasHolder; delete this.goalCanvasHolder;
}, },
goalDie: function() {
this.goalCanvasHolder.die();
this.goalVis.die();
},
getInstantCommands: function() { getInstantCommands: function() {
var hintMsg = (this.level.hint) ? var hintMsg = (this.level.hint) ?
this.level.hint : this.level.hint :