diff options
| -rw-r--r-- | js/shader.js | 10 | ||||
| -rw-r--r-- | js/ui/brush.js | 26 |
2 files changed, 8 insertions, 28 deletions
diff --git a/js/shader.js b/js/shader.js index 2e59ea3..2c30896 100644 --- a/js/shader.js +++ b/js/shader.js @@ -20,8 +20,7 @@ var shader = (function(){ } exports.run = function(canvas){ var t = +new Date - // var shader_canvas = brush - selection.hidden ? canvas : selection.canvas; + var shader_canvas = selection.hidden ? canvas : selection.canvas; var w = shader_canvas.w, h = shader_canvas.h shader_canvas.forEach(function(lex, x, y){ fn(lex, x, y, w, h, t) @@ -39,14 +38,9 @@ var shader = (function(){ animating = true } exports.animate = function (t){ - // requestAnimationFrame(exports.animate) - if (! animating) { - requestAnimationFrame(exports.animate) - return } else { + if (! animating) { return } exports.run(canvas) - requestAnimationFrame(exports.animate) - } } return exports diff --git a/js/ui/brush.js b/js/ui/brush.js index 90422b7..8cc858f 100644 --- a/js/ui/brush.js +++ b/js/ui/brush.js @@ -44,7 +44,6 @@ var brush = (function(){ lex.fill(brush) } brush.focus(x, y) - // lex.focus() }) lex.span.addEventListener('mousemove', function(e){ e.preventDefault() @@ -59,7 +58,6 @@ var brush = (function(){ lex.fill(brush) } brush.focus(x, y) - //lex.focus() }) }) window.addEventListener('mouseup', function(e){ @@ -67,35 +65,23 @@ var brush = (function(){ }) } - brush.resize = function(w, h, min, max){ - this.w = clamp(w, this.min, this.max) - this.h = clamp(h, this.min, this.max) - // brush.__proto__.resize.call(brush, w, h) - // this.w = w - // this.h = h - this.rebuild() - //brush.__proto__.rebuild.call(brush, w, h) - controls.brush_w.char = ""+this.w + brush.resize = function(w, h){ + w = this.w = clamp(w, this.min, this.max) + h = this.h = clamp(h, this.min, this.max) + brush.rebuild() + controls.brush_w.char = "" + w controls.brush_w.build() - controls.brush_h.char = ""+this.h + controls.brush_h.char = "" + h controls.brush_h.build() } brush.size_add = function(w, h){ brush.resize(brush.w + w, brush.h + h) } - brush.expand = function(i){ brush.size_add(i, i) - // var w = this.w = clamp(this.w+i, 1, 9), h = this.h = clamp(this.h+i, 1, 9) - // controls.width.char = ""+w - // controls.width.build() - // controls.height.char = ""+h - // controls.height.build() - // this.rebuild() } brush.contract = function(i){ brush.size_add(-i, -i) - // this.expand(-i) } brush.load = function(lex){ |
