optimized CSS a bit

This commit is contained in:
Peter Cottle 2013-01-05 12:35:37 -08:00
parent 19b6038f55
commit d5f456fa0c
10 changed files with 615 additions and 489 deletions

File diff suppressed because it is too large Load diff

View file

@ -96,7 +96,7 @@
</script>
<script type="text/html" id="terminal-window-bare-template">
<div class="terminal-window-holder box flex3 vertical transitionTransform">
<div class="terminal-window-holder box flex3 vertical transitionTransform slideOut">
<div class="wrapper box vertical">
<div class="toolbar box vertical">
<div class="controls box horizontal">

View file

@ -5,6 +5,23 @@ function TreeCompare() {
}
TreeCompare.prototype.compareAllBranchesWithinTrees = function(treeA, treeB) {
treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB);
var allBranches = _.extend(
{},
treeA.branches,
treeB.branches
);
var result = true;
_.uniq(allBranches, function(info, branch) {
result = result && this.compareBranchWithinTrees(treeA, treeB, branch);
}, this);
return result;
};
TreeCompare.prototype.compareBranchesWithinTrees = function(treeA, treeB, branches) {
var result = true;
_.each(branches, function(branchName) {

View file

@ -36,6 +36,7 @@ var Level = Sandbox.extend({
this.initGoalData(options);
Sandbox.prototype.initialize.apply(this, [options]);
this.startOffCommand();
},
initGoalData: function(options) {
@ -58,6 +59,13 @@ var Level = Sandbox.extend({
Sandbox.prototype.takeControl.apply(this);
},
startOffCommand: function() {
Main.getEventBaton().trigger(
'commandSubmitted',
'hint; show goal; delay 2000; hide goal'
);
},
initVisualization: function(options) {
if (!options.level.startTree) {
console.warn('No start tree specified for this level!!! using default...');
@ -174,11 +182,10 @@ var Level = Sandbox.extend({
require('../level/commands').parse
);
/*
this.parseWaterfall.addFirst(
'instantWaterfall',
this.getInstantCommands()
);*/
);
// if we want to disable certain commands...
if (options.level.disabledMap) {
@ -243,7 +250,7 @@ var Level = Sandbox.extend({
// ok so lets see if they solved it...
var current = this.mainVis.gitEngine.exportTree();
var solved = this.treeCompare.compareTrees(current, this.goalTreeString);
var solved = this.treeCompare.compareAllBranchesWithinTrees(current, this.goalTreeString);
if (!solved) {
defer.resolve();

View file

@ -1,4 +1,5 @@
var _ = require('underscore');
var Q = require('q');
// horrible hack to get localStorage Backbone plugin
var Backbone = (!require('../util').isBrowser()) ? require('backbone') : window.Backbone;
@ -81,6 +82,7 @@ var Sandbox = Backbone.View.extend({
Main.getEvents().trigger('commandSubmittedPassive', value);
util.splitTextCommand(value, function(command) {
console.log('adding command', command);
this.commandCollection.add(new Command({
rawStr: command,
parseWaterfall: this.parseWaterfall
@ -91,7 +93,8 @@ var Sandbox = Backbone.View.extend({
processSandboxCommand: function(command, deferred) {
var commandMap = {
help: this.helpDialog,
reset: this.reset
reset: this.reset,
delay: this.delay
};
var method = commandMap[command.get('method')];
if (!method) { throw new Error('no method for that wut'); }
@ -99,6 +102,13 @@ var Sandbox = Backbone.View.extend({
method.apply(this, [command, deferred]);
},
delay: function(command, deferred) {
var amount = parseInt(command.get('regexResults')[1], 10);
setTimeout(function() {
command.finishWith(deferred);
}, amount);
},
reset: function(command, deferred) {
this.mainVis.reset();
setTimeout(function() {

View file

@ -38,22 +38,27 @@ var instantCommands = [
var regexMap = {
'help': /^help($|\s)|\?/,
'reset': /^reset($|\s)/
'reset': /^reset($|\s)/,
'delay': /^delay (\d+)$/
};
var parse = function(str) {
var sandboxMethod;
var regexResults;
_.each(regexMap, function(regex, method) {
if (regex.test(str)) {
var results = regex.exec(str);
if (results) {
sandboxMethod = method;
regexResults = results;
}
});
return (!sandboxMethod) ? false : {
toSet: {
eventName: 'processSandboxCommand',
method: sandboxMethod
method: sandboxMethod,
regexResults: regexResults
}
};
};

View file

@ -67,7 +67,7 @@ var CommandBuffer = Backbone.Model.extend({
// find a command with no error (aka unprocessed)
while (popped.get('error') && this.buffer.length) {
popped = this.buffer.pop();
popped = this.buffer.shift(0);
}
if (!popped.get('error')) {
this.processCommand(popped);

View file

@ -199,6 +199,9 @@ var ModalView = Backbone.View.extend({
},
toggleShow: function(value) {
// this prevents releasing keyboard twice
if (this.shown === value) { return; }
if (value) {
this.stealKeyboard();
} else {

View file

@ -139,44 +139,44 @@ div.canvasTerminalHolder {
min-height: 600px;
}
div.canvasTerminalHolder div.terminal-window-holder {
div.canvasTerminalHolder > div.terminal-window-holder {
margin: 50px 0;
height: 100%;
-webkit-transform: translate3d(0,0,0);
}
div.canvasTerminalHolder div.terminal-window-holder.slideOut {
div.canvasTerminalHolder > div.terminal-window-holder.slideOut {
-webkit-transform: translate3d(-150%,0,0);
}
div.canvasTerminalHolder div.terminal-window-holder div.wrapper {
div.canvasTerminalHolder > div.terminal-window-holder > div.wrapper {
margin: 0 20px 0px 20px;
height: 80%;
box-shadow: 0 0 30px rgb(0,0,0);
cursor: pointer;
}
div.canvasTerminalHolder div.terminal-window-holder div.terminal-text {
div.canvasTerminalHolder > div.terminal-window-holder div.terminal-text {
padding: 5px 10px;
}
div.canvasTerminalHolder div.terminal-window-holder div.toolbar,
div.canvasTerminalHolder div.terminal-window-holder div.terminal-text,
div.canvasTerminalHolder div.terminal-window-holder div.inside {
div.canvasTerminalHolder > div.terminal-window-holder div.toolbar,
div.canvasTerminalHolder > div.terminal-window-holder div.terminal-text,
div.canvasTerminalHolder > div.terminal-window-holder div.inside {
border: 0px;
}
div.canvasTerminalHolder div.terminal-window-holder div.terminal-text,
div.canvasTerminalHolder div.terminal-window-holder div.inside {
div.canvasTerminalHolder > div.terminal-window-holder div.terminal-text,
div.canvasTerminalHolder > div.terminal-window-holder div.inside {
background: #ff4c7e;
}
div.canvasTerminalHolder div.terminal-window-holder div.inside {
div.canvasTerminalHolder > div.terminal-window-holder div.inside {
min-height: 200px;
border-radius: 0 0 5px 5px;
}
div.canvasTerminalHolder div.terminal-window-holder,
div.canvasTerminalHolder > div.terminal-window-holder,
#controls {
max-width: 400px;
}
@ -204,7 +204,7 @@ div.toolbar {
-webkit-box-pack: center;
}
div.toolbar div.controls {
div.toolbar > div.controls {
position: absolute;
top: 9px;
left: 9px;
@ -213,15 +213,15 @@ div.toolbar div.controls {
-webkit-box-pack: justify;
}
div.toolbar div.controls div i {
div.toolbar > div.controls div i {
text-shadow: 0.1em 0.1em rgba(255, 255, 255, 0.5);
}
div.toolbar div.controls div.box.flex1 {
div.toolbar > div.controls div.box.flex1 {
text-align: center;
}
div.toolbar div.controls div.box.flex1 div {
div.toolbar > div.controls div.box.flex1 div {
width: 12px;
height: 11px;
border-radius: 24px;
@ -261,7 +261,8 @@ div.controls div.box.flex1 div.plus {
/* Command Line */
p.commandLine, div.commandLineResult {
p.commandLine,
div.commandLineResult {
opacity: 1;
font-size: 16px;
margin: 0px;
@ -358,11 +359,6 @@ p.commandLine span.prompt {
#commandLineHistory {
margin: 10px;
border-radius: 5px;
/*
UGHHHh the box shadow looks SO much better, but causes an extra 12ms in the paint update
when typing in the box. sadness. i will remove for perf, maybe add back in later.
box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
*/
}
#prompt {

View file

@ -21,7 +21,7 @@ Minor Bugs to fix:
Big Bugs to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ ] window zoom alert thing
[ ] window zoom alert thing -- this just needs to be timeouted one more time
[ ] click handlers on goal visualization for the actual canvas elements
/*************************************
@ -33,6 +33,10 @@ Big Bugs to fix:
Done things:
(I only started this on Dec 17th 2012 to get a better sense of what was done)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[x] put in some > into the rules for CSS
[x] fix bug for multiview, i think its from the die() on everyone
[x] fixed bug in command queue
[x] better compare in levels
[x] show solution
[x] show goal
[x] reset for sandbox command