diff options
| author | timb <opuscule@gmail.com> | 2015-06-10 17:49:41 -0400 |
|---|---|---|
| committer | timb <opuscule@gmail.com> | 2015-06-10 17:49:41 -0400 |
| commit | 3f1b27a8e876f3e3c21f3449f6fc571d5381faa6 (patch) | |
| tree | 1620e5b57089c2f00e7d6454be50b3b0205fa32a | |
| parent | 1b1109b59a8e4d64aab2f8494e9df051a2028044 (diff) | |
formatting (rm tabs)
| -rw-r--r-- | js/blit.js | 10 | ||||
| -rw-r--r-- | js/ui/controls.js | 29 | ||||
| -rw-r--r-- | js/ui/keys.js | 103 |
3 files changed, 71 insertions, 71 deletions
@@ -72,11 +72,11 @@ var blit = (function(){ }) } blit.cross = function(A, lex){ - A.forEach(function(lex,x,y) { - if ((x+y)%2) { - lex.clear() - } - }) + A.forEach(function(lex,x,y) { + if ((x+y)%2) { + lex.clear() + } + }) } return blit diff --git a/js/ui/controls.js b/js/ui/controls.js index 0665747..6b34ff7 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -10,7 +10,7 @@ var controls = (function(){ brush.modified = false } controls.cross.generate = function(){ - brush.fill(brush) + brush.fill(brush) blit.cross(brush) } controls.cross.done = function(){ @@ -25,7 +25,7 @@ var controls = (function(){ brush.modified = false } controls.circle.generate = function(){ - brush.fill(brush) + brush.fill(brush) blit.circle(brush) } controls.circle.done = function(){ @@ -40,7 +40,7 @@ var controls = (function(){ drawing = true } controls.square.generate = function(){ - brush.fill(brush) + brush.fill(brush) } controls.square.done = function(){ drawing = false @@ -74,9 +74,9 @@ var controls = (function(){ controls.clear = new BlurredTool (clear_el) controls.clear.use = function(){ - if (confirm("really delete this colorcode?")) { - canvas.erase() - } + if (confirm("really delete this colorcode?")) { + canvas.erase() + } } controls.webcam = new BlurredTool (webcam_el) @@ -140,16 +140,15 @@ var controls = (function(){ // var ShaderTool = Tool.extend({ - active: false, + active: false, use: function(state){ - this.active = typeof state == "boolean" ? state : ! this.active - if (this.active) { - shader_rapper.style.display = "block" - shader_textarea.focus() - } - else { - shader_rapper.style.display = "none" - } + this.active = typeof state == "boolean" ? state : ! this.active + if (this.active) { + shader_rapper.style.display = "block" + shader_textarea.focus() + } else { + shader_rapper.style.display = "none" + } }, done: function(){ this.use(false) diff --git a/js/ui/keys.js b/js/ui/keys.js index c8df3e8..68b3fbf 100644 --- a/js/ui/keys.js +++ b/js/ui/keys.js @@ -122,57 +122,58 @@ var keys = (function(){ ! isNaN(n) && f(n) } } - keys.arrow_key = function (lex, canvas, prop, rebuild_prop, min, max) { - return function (e){ - switch (e.keyCode) { - case 38: // up - e.preventDefault() - canvas[prop] = Math.min(canvas[prop]+1, max) - lex.char = "" + canvas[prop] - lex.build() - canvas[rebuild_prop]() - break - case 40: // down - e.preventDefault() - canvas[prop] = Math.max(canvas[prop]-1, min) - lex.char = "" + canvas[prop] - lex.build() - canvas[rebuild_prop]() - break - } - } - } - keys.single_numeral_key = function (lex, canvas, prop, min, max) { - return keys.int_key(function(n, keyCode){ - if (n == 0) n = 10 - lex.blur() - lex.char = ""+n - lex.build() - canvas[prop] = n - canvas.rebuild() - }) - } - keys.multi_numeral_key = function (lex, digits){ - return keys.int_key(function(n, keyCode){ - lex.read() - if (lex.char.length < digits) { - n = parseInt(lex.char) * 10 + n - } - lex.char = ""+n - lex.build() - }) - } - keys.multi_numeral_blur = function (lex, canvas, prop, min, max){ - return function(){ - var current = parseInt(lex.char) - var n = clamp(current, min, max) - if (! n || isNaN(current)) return - lex.char = n+"" - lex.build() - canvas[prop] = n - canvas.resize(canvas.w, canvas.h) - } - } + + keys.arrow_key = function (lex, canvas, prop, rebuild_prop, min, max) { + return function (e){ + switch (e.keyCode) { + case 38: // up + e.preventDefault() + canvas[prop] = Math.min(canvas[prop]+1, max) + lex.char = "" + canvas[prop] + lex.build() + canvas[rebuild_prop]() + break + case 40: // down + e.preventDefault() + canvas[prop] = Math.max(canvas[prop]-1, min) + lex.char = "" + canvas[prop] + lex.build() + canvas[rebuild_prop]() + break + } + } + } + keys.single_numeral_key = function (lex, canvas, prop, min, max) { + return keys.int_key(function(n, keyCode){ + if (n == 0) n = 10 + lex.blur() + lex.char = ""+n + lex.build() + canvas[prop] = n + canvas.rebuild() + }) + } + keys.multi_numeral_key = function (lex, digits){ + return keys.int_key(function(n, keyCode){ + lex.read() + if (lex.char.length < digits) { + n = parseInt(lex.char) * 10 + n + } + lex.char = ""+n + lex.build() + }) + } + keys.multi_numeral_blur = function (lex, canvas, prop, min, max){ + return function(){ + var current = parseInt(lex.char) + var n = clamp(current, min, max) + if (! n || isNaN(current)) return + lex.char = n+"" + lex.build() + canvas[prop] = n + canvas.resize(canvas.w, canvas.h) + } + } return keys })() |
