Whitespace

This commit is contained in:
Kyle Kingsbury 2014-02-24 16:15:46 -08:00
parent 6e76c97618
commit 00bbea6095

View file

@ -3,7 +3,7 @@ var view = (function() {
var focused = null;
var focusOverlay = $('<div class="focusOverlay"></div>');
$('body').append(focusOverlay);
// Unfocus all views.
var unfocus = function() {
if (focused) {
@ -19,8 +19,8 @@ var view = (function() {
}
function inherit(sup, sub) {
var newSubPrototype = createObject(sup.prototype);
newSubPrototype.constructor = sub;
var newSubPrototype = createObject(sup.prototype);
newSubPrototype.constructor = sub;
sub.prototype = newSubPrototype;
}
@ -29,12 +29,12 @@ var view = (function() {
var t = types[json.type];
return(new t(json));
}
// Initialize keybindings
function setKeyBindings() {
var focusedBindings = {
// left
37: function(ev) {
37: function(ev) {
if (ev.ctrlKey === true) {
focused.split('HStack', -1);
} else {
@ -49,8 +49,8 @@ var view = (function() {
} else {
focused.moveVertical(-1);
}
},
},
// right
39: function(ev) {
if (ev.ctrlKey === true) {
@ -58,17 +58,17 @@ var view = (function() {
} else {
focused.moveHorizontal(1);
}
},
},
// down
40: function(ev) {
40: function(ev) {
if (ev.ctrlKey === true) {
focused.split('VStack', 1);
} else {
focused.moveVertical(1);
}
},
27: function() { focused.unfocus() }, // escape
33: function() { if (focused.parent) { // pgup
focused.parent.focus();
@ -84,7 +84,7 @@ var view = (function() {
189: function() { focused.shrink(); }, // -
107: function() { focused.grow(); }, // + (NumPad)
109: function() { focused.shrink(); } // - (NumPad)
};
var bindings = {};
@ -167,7 +167,7 @@ var view = (function() {
View.prototype.grow = function() {
this.weight *= 2;
this.parent.reflow();
this.parent.reflow();
focused.refocus();
};
@ -186,7 +186,7 @@ var view = (function() {
if (p == null) {
throw "Sorry, can't replace top-level views.";
}
if (p.replaceChild == null) {
throw "Sorry, can't replace unless parent can replace child.";
}
@ -226,7 +226,7 @@ var view = (function() {
// new view before us) or +1 (place the new view after us).
View.prototype.splitParentStack = function(i) {
console.log("Split parent");
if (i === null) { i = 0 }
if (i === null) { i = 0 }
var index = this.parent.indexOf(this) - Math.min(i, 0);
console.log(this.parent.indexOf(this), index);
this.parent.insertChild(
@ -251,7 +251,7 @@ var view = (function() {
weight: this.weight
});
parent.replaceChild(this, stack);
// Add self to stack
this.weight = 1;
if (i === -1) {
@ -318,7 +318,7 @@ var view = (function() {
return null;
}
}
// Returns the nearest parent vstack
View.prototype.enclosingVStack = function() {
try {
@ -374,7 +374,7 @@ var view = (function() {
// left. Nothing *needs* to happen, so we return immediately.
return;
}
// We're moving to a new position inside the enclosing stack.
this.removeFromParent();
stack.insertChild(newI, this);
@ -384,7 +384,7 @@ var view = (function() {
console.log("Sorry, not yet");
}
}
View.prototype.moveHorizontal = function(delta) {
this.move('enclosingHStack', delta);
}
@ -406,7 +406,7 @@ var view = (function() {
'<button name="apply">Apply</button>' +
'</form></div>');
dialog.find('h1').text("Edit " + this.type);
// The serialized representation of a view that we're editing.
// Carried between various view types; when Apply is clicked, projected
// into an actual view.
@ -446,7 +446,7 @@ var view = (function() {
});
// Apply button.
var me = this;
var me = this;
dialog.find('button[name=apply]').click(function(e) {
// Don't submit the form.
e.preventDefault();
@ -486,7 +486,7 @@ var view = (function() {
this.clickFocusable = false;
this.el.detach();
this.el.appendTo(this.container);
this.child = reify(json.child);
this.child.parent = this;
this.el.append(this.child.el);
@ -504,7 +504,7 @@ var view = (function() {
Balloon.prototype.replaceChild = function(v1, v2) {
this.child.parent = null;
this.child.el.detach();
this.child = v2;
v2.parent = this;
this.el.append(this.child.el);
@ -668,13 +668,13 @@ var view = (function() {
};
inherit(Stack, VStack);
types.VStack = VStack;
VStack.prototype.json = function() {
return $.extend(Stack.prototype.json.call(this), {type: 'VStack'});
}
VStack.prototype.isVStack = true;
VStack.prototype.reflow = function() {
if (this.el === null) {
// We're gone.