summaryrefslogtreecommitdiff
path: root/js/ui/canvas.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-12-11 16:15:06 -0500
committerJules Laplace <jules@okfoc.us>2014-12-11 16:15:06 -0500
commit2de4442f9aeb6a4fc5d49fab8a15b41d87ff2fe4 (patch)
treebe82d6abf894943528e358bf22ab472687835808 /js/ui/canvas.js
parent66488f43e9c19e3c286ff93c051af21ce01c5b86 (diff)
starting to write this stuff the fishbone thing is screwing me up
Diffstat (limited to 'js/ui/canvas.js')
-rw-r--r--js/ui/canvas.js23
1 files changed, 9 insertions, 14 deletions
diff --git a/js/ui/canvas.js b/js/ui/canvas.js
index 7e75ef6..c70b135 100644
--- a/js/ui/canvas.js
+++ b/js/ui/canvas.js
@@ -2,7 +2,6 @@ var canvas = current_canvas = (function(){
var cols = 80
var rows = 24
- var last_point = [0,0]
var exports = new Matrix (cols, rows, function(x,y){
var lex = new Lex (x,y)
@@ -25,24 +24,20 @@ var canvas = current_canvas = (function(){
dragging = true
current_canvas = canvas
if (drawing) {
- erasing = (e.which == "3" || e.ctrlKey)
- if (e.shiftKey) {
- line(lex, last_point, point, erasing)
- }
- else {
- 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)
}
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()
})