diff options
| author | Julie Lala <jules@okfoc.us> | 2014-12-18 23:21:00 -0500 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-12-18 23:21:00 -0500 |
| commit | 6946255bb23b50e841a6684dc8950797d2a5dce6 (patch) | |
| tree | d1390e405e5302bdbc03d115a6e20afae8469739 /js/ui/canvas.js | |
| parent | dda251707cd91ec5d377816de4ea7a6e3da4147e (diff) | |
| parent | 8746a003b0226cd7bd67eca8fcf3774313021093 (diff) | |
merge
Diffstat (limited to 'js/ui/canvas.js')
| -rw-r--r-- | js/ui/canvas.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/js/ui/canvas.js b/js/ui/canvas.js index 4b595a5..206cbee 100644 --- a/js/ui/canvas.js +++ b/js/ui/canvas.js @@ -1,4 +1,4 @@ -var canvas = (function(){ +var canvas = current_canvas = (function(){ var cols = 80 var rows = 24 @@ -11,8 +11,6 @@ var canvas = (function(){ exports.bind = function(){ - var last_point = [0,0] - exports.forEach(function(lex, x, y){ if (lex.bound) return @@ -26,19 +24,23 @@ var canvas = (function(){ dragging = true current_canvas = canvas if (drawing) { - erasing = (e.which == "3" || e.ctrlKey) - draw(lex, x, y, erasing) - last_point[0] = x - last_point[1] = y + draw.down(e, lex, point) + } + else if (selecting) { + selection.down(e, lex, point) + } + else if (filling) { + draw.fill(brush, x, y) } lex.focus() }) - lex.span.addEventListener("mousemove", function(){ + lex.span.addEventListener("mousemove", function(e){ if (! dragging) return if (drawing) { - line(lex, last_point, point, erasing) - last_point[0] = x - last_point[1] = y + draw.move(e, lex, point) + } + else if (selecting) { + selection.move(e, lex, point) } lex.focus() }) |
