mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
hide and show goal
This commit is contained in:
parent
9bb6b5c2d9
commit
a12bc276ae
6 changed files with 138 additions and 35 deletions
121
build/bundle.js
121
build/bundle.js
|
@ -4770,6 +4770,12 @@ var Level = Sandbox.extend({
|
||||||
Sandbox.prototype.initialize.apply(this, [options]);
|
Sandbox.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
takeControl: function() {
|
||||||
|
Main.getEventBaton().stealBaton('processLevelCommand', this.processLevelCommand, this);
|
||||||
|
|
||||||
|
Sandbox.prototype.takeControl.apply(this);
|
||||||
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
if (!options.level.startTree) {
|
if (!options.level.startTree) {
|
||||||
console.warn('No start tree specified for this level!!! using default...');
|
console.warn('No start tree specified for this level!!! using default...');
|
||||||
|
@ -4798,26 +4804,31 @@ var Level = Sandbox.extend({
|
||||||
treeString: this.goalTreeString,
|
treeString: this.goalTreeString,
|
||||||
noKeyboardInput: true
|
noKeyboardInput: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.goalVis.customEvents.on('paperReady', _.bind(function() {
|
|
||||||
// this is tricky. at this point we have a canvas that has 0
|
|
||||||
// opacity but its floating in front of our command history. we need
|
|
||||||
// to move it out without an animation and then give it an opacity of 1
|
|
||||||
this.goalVis.setTreeOpacity(1);
|
|
||||||
}, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showGoal: function() {
|
showGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideIn();
|
this.goalCanvasHolder.slideIn();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
hideGoal: function() {
|
hideGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideOut();
|
this.goalCanvasHolder.slideOut();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
this.parseWaterfall = new ParseWaterfall();
|
this.parseWaterfall = new ParseWaterfall();
|
||||||
|
|
||||||
|
// add our specific functionaity
|
||||||
|
this.parseWaterfall.addFirst(
|
||||||
|
'parseWaterfall',
|
||||||
|
require('../level/commands').parse
|
||||||
|
);
|
||||||
|
|
||||||
// if we want to disable certain commands...
|
// if we want to disable certain commands...
|
||||||
if (options.level.disabledMap) {
|
if (options.level.disabledMap) {
|
||||||
// disable these other commands
|
// disable these other commands
|
||||||
|
@ -4905,8 +4916,19 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function() {
|
processLevelCommand: function(command, defer) {
|
||||||
|
console.log('processing command...');
|
||||||
|
var methodMap = {
|
||||||
|
'show goal': this.showGoal,
|
||||||
|
'hide goal': this.hideGoal,
|
||||||
|
'show solution': this.showSolution
|
||||||
|
};
|
||||||
|
var method = methodMap[command.get('method')];
|
||||||
|
if (!method) {
|
||||||
|
throw new Error('woah we dont support that method yet', method);
|
||||||
|
}
|
||||||
|
|
||||||
|
method.apply(this, [command, defer]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9470,6 +9492,8 @@ var CanvasTerminalHolder = BaseView.extend({
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAnimationTime: function() { return 700; },
|
||||||
|
|
||||||
slideOut: function() {
|
slideOut: function() {
|
||||||
this.slideToggle(true);
|
this.slideToggle(true);
|
||||||
},
|
},
|
||||||
|
@ -14506,6 +14530,36 @@ exports.KeyboardListener = KeyboardListener;
|
||||||
exports.mapKeycodeToKey = mapKeycodeToKey;
|
exports.mapKeycodeToKey = mapKeycodeToKey;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
require.define("/src/js/level/commands.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||||
|
|
||||||
|
var regexMap = {
|
||||||
|
'show goal': /^show goal$/,
|
||||||
|
'hide goal': /^hide goal$/,
|
||||||
|
'show solution': /^show solution$/
|
||||||
|
};
|
||||||
|
|
||||||
|
var parse = function(str) {
|
||||||
|
var levelMethod;
|
||||||
|
|
||||||
|
_.each(regexMap, function(regex, method) {
|
||||||
|
if (regex.test(str)) {
|
||||||
|
levelMethod = method;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (!levelMethod) ? false : {
|
||||||
|
toSet: {
|
||||||
|
eventName: 'processLevelCommand',
|
||||||
|
method: levelMethod
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.parse = parse;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
require.define("/src/js/util/zoomLevel.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
require.define("/src/js/util/zoomLevel.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||||
|
@ -17328,8 +17382,7 @@ require.define("/src/js/level/commands.js",function(require,module,exports,__dir
|
||||||
var regexMap = {
|
var regexMap = {
|
||||||
'show goal': /^show goal$/,
|
'show goal': /^show goal$/,
|
||||||
'hide goal': /^hide goal$/,
|
'hide goal': /^hide goal$/,
|
||||||
'show solution': /^show solution$/,
|
'show solution': /^show solution$/
|
||||||
'hint': /^hint$/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
@ -17440,6 +17493,12 @@ var Level = Sandbox.extend({
|
||||||
Sandbox.prototype.initialize.apply(this, [options]);
|
Sandbox.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
takeControl: function() {
|
||||||
|
Main.getEventBaton().stealBaton('processLevelCommand', this.processLevelCommand, this);
|
||||||
|
|
||||||
|
Sandbox.prototype.takeControl.apply(this);
|
||||||
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
if (!options.level.startTree) {
|
if (!options.level.startTree) {
|
||||||
console.warn('No start tree specified for this level!!! using default...');
|
console.warn('No start tree specified for this level!!! using default...');
|
||||||
|
@ -17468,26 +17527,31 @@ var Level = Sandbox.extend({
|
||||||
treeString: this.goalTreeString,
|
treeString: this.goalTreeString,
|
||||||
noKeyboardInput: true
|
noKeyboardInput: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.goalVis.customEvents.on('paperReady', _.bind(function() {
|
|
||||||
// this is tricky. at this point we have a canvas that has 0
|
|
||||||
// opacity but its floating in front of our command history. we need
|
|
||||||
// to move it out without an animation and then give it an opacity of 1
|
|
||||||
this.goalVis.setTreeOpacity(1);
|
|
||||||
}, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showGoal: function() {
|
showGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideIn();
|
this.goalCanvasHolder.slideIn();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
hideGoal: function() {
|
hideGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideOut();
|
this.goalCanvasHolder.slideOut();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
this.parseWaterfall = new ParseWaterfall();
|
this.parseWaterfall = new ParseWaterfall();
|
||||||
|
|
||||||
|
// add our specific functionaity
|
||||||
|
this.parseWaterfall.addFirst(
|
||||||
|
'parseWaterfall',
|
||||||
|
require('../level/commands').parse
|
||||||
|
);
|
||||||
|
|
||||||
// if we want to disable certain commands...
|
// if we want to disable certain commands...
|
||||||
if (options.level.disabledMap) {
|
if (options.level.disabledMap) {
|
||||||
// disable these other commands
|
// disable these other commands
|
||||||
|
@ -17575,8 +17639,19 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function() {
|
processLevelCommand: function(command, defer) {
|
||||||
|
console.log('processing command...');
|
||||||
|
var methodMap = {
|
||||||
|
'show goal': this.showGoal,
|
||||||
|
'hide goal': this.hideGoal,
|
||||||
|
'show solution': this.showSolution
|
||||||
|
};
|
||||||
|
var method = methodMap[command.get('method')];
|
||||||
|
if (!method) {
|
||||||
|
throw new Error('woah we dont support that method yet', method);
|
||||||
|
}
|
||||||
|
|
||||||
|
method.apply(this, [command, defer]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -19266,6 +19341,8 @@ var CanvasTerminalHolder = BaseView.extend({
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAnimationTime: function() { return 700; },
|
||||||
|
|
||||||
slideOut: function() {
|
slideOut: function() {
|
||||||
this.slideToggle(true);
|
this.slideToggle(true);
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,8 +3,7 @@ var _ = require('underscore');
|
||||||
var regexMap = {
|
var regexMap = {
|
||||||
'show goal': /^show goal$/,
|
'show goal': /^show goal$/,
|
||||||
'hide goal': /^hide goal$/,
|
'hide goal': /^hide goal$/,
|
||||||
'show solution': /^show solution$/,
|
'show solution': /^show solution$/
|
||||||
'hint': /^hint$/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
|
|
@ -40,6 +40,12 @@ var Level = Sandbox.extend({
|
||||||
Sandbox.prototype.initialize.apply(this, [options]);
|
Sandbox.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
takeControl: function() {
|
||||||
|
Main.getEventBaton().stealBaton('processLevelCommand', this.processLevelCommand, this);
|
||||||
|
|
||||||
|
Sandbox.prototype.takeControl.apply(this);
|
||||||
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
if (!options.level.startTree) {
|
if (!options.level.startTree) {
|
||||||
console.warn('No start tree specified for this level!!! using default...');
|
console.warn('No start tree specified for this level!!! using default...');
|
||||||
|
@ -68,26 +74,31 @@ var Level = Sandbox.extend({
|
||||||
treeString: this.goalTreeString,
|
treeString: this.goalTreeString,
|
||||||
noKeyboardInput: true
|
noKeyboardInput: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.goalVis.customEvents.on('paperReady', _.bind(function() {
|
|
||||||
// this is tricky. at this point we have a canvas that has 0
|
|
||||||
// opacity but its floating in front of our command history. we need
|
|
||||||
// to move it out without an animation and then give it an opacity of 1
|
|
||||||
this.goalVis.setTreeOpacity(1);
|
|
||||||
}, this));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showGoal: function() {
|
showGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideIn();
|
this.goalCanvasHolder.slideIn();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
hideGoal: function() {
|
hideGoal: function(command, defer) {
|
||||||
this.goalCanvasHolder.slideOut();
|
this.goalCanvasHolder.slideOut();
|
||||||
|
setTimeout(function() {
|
||||||
|
command.finishWith(defer);
|
||||||
|
}, this.goalCanvasHolder.getAnimationTime());
|
||||||
},
|
},
|
||||||
|
|
||||||
initParseWaterfall: function(options) {
|
initParseWaterfall: function(options) {
|
||||||
this.parseWaterfall = new ParseWaterfall();
|
this.parseWaterfall = new ParseWaterfall();
|
||||||
|
|
||||||
|
// add our specific functionaity
|
||||||
|
this.parseWaterfall.addFirst(
|
||||||
|
'parseWaterfall',
|
||||||
|
require('../level/commands').parse
|
||||||
|
);
|
||||||
|
|
||||||
// if we want to disable certain commands...
|
// if we want to disable certain commands...
|
||||||
if (options.level.disabledMap) {
|
if (options.level.disabledMap) {
|
||||||
// disable these other commands
|
// disable these other commands
|
||||||
|
@ -175,8 +186,19 @@ var Level = Sandbox.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function() {
|
processLevelCommand: function(command, defer) {
|
||||||
|
console.log('processing command...');
|
||||||
|
var methodMap = {
|
||||||
|
'show goal': this.showGoal,
|
||||||
|
'hide goal': this.hideGoal,
|
||||||
|
'show solution': this.showSolution
|
||||||
|
};
|
||||||
|
var method = methodMap[command.get('method')];
|
||||||
|
if (!method) {
|
||||||
|
throw new Error('woah we dont support that method yet', method);
|
||||||
|
}
|
||||||
|
|
||||||
|
method.apply(this, [command, defer]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,8 @@ var CanvasTerminalHolder = BaseView.extend({
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAnimationTime: function() { return 700; },
|
||||||
|
|
||||||
slideOut: function() {
|
slideOut: function() {
|
||||||
this.slideToggle(true);
|
this.slideToggle(true);
|
||||||
},
|
},
|
||||||
|
|
|
@ -140,7 +140,7 @@ div.canvasTerminalHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
div.canvasTerminalHolder div.terminal-window-holder {
|
div.canvasTerminalHolder div.terminal-window-holder {
|
||||||
margin: 10% 0;
|
margin: 50px 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
-webkit-transform: translate3d(0,0,0);
|
-webkit-transform: translate3d(0,0,0);
|
||||||
}
|
}
|
||||||
|
|
3
todo.txt
3
todo.txt
|
@ -23,6 +23,9 @@ Minor Bugs to fix:
|
||||||
|
|
||||||
Big Bugs to fix:
|
Big Bugs to fix:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[ ] window zoom alert thing
|
||||||
|
[ ] better stuff for modals stealing input
|
||||||
|
[ ] click handlers on goal visualization
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
** Publish Things **
|
** Publish Things **
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue