summaryrefslogtreecommitdiff
path: root/js/ui
diff options
context:
space:
mode:
Diffstat (limited to 'js/ui')
-rw-r--r--js/ui/brush.js2
-rw-r--r--js/ui/canvas.js3
-rw-r--r--js/ui/controls.js12
3 files changed, 16 insertions, 1 deletions
diff --git a/js/ui/brush.js b/js/ui/brush.js
index c7cf583..50f6e07 100644
--- a/js/ui/brush.js
+++ b/js/ui/brush.js
@@ -68,8 +68,10 @@ var brush = (function(){
this.expand(-i)
}
+ brush.char = " "
brush.fg = 0
brush.bg = 1
+ brush.opacity = 1
return brush
diff --git a/js/ui/canvas.js b/js/ui/canvas.js
index c70b135..206cbee 100644
--- a/js/ui/canvas.js
+++ b/js/ui/canvas.js
@@ -29,6 +29,9 @@ var canvas = current_canvas = (function(){
else if (selecting) {
selection.down(e, lex, point)
}
+ else if (filling) {
+ draw.fill(brush, x, y)
+ }
lex.focus()
})
lex.span.addEventListener("mousemove", function(e){
diff --git a/js/ui/controls.js b/js/ui/controls.js
index 293cd1d..bbf93cc 100644
--- a/js/ui/controls.js
+++ b/js/ui/controls.js
@@ -7,6 +7,7 @@ var controls = (function(){
brush.generate = controls.circle.generate
brush.generate()
drawing = true
+ filling = false
selection.hide()
brush.modified = false
}
@@ -30,6 +31,7 @@ var controls = (function(){
brush.generate()
brush.modified = false
drawing = true
+ filling = false
selection.hide()
}
controls.square.generate = function(){
@@ -42,6 +44,7 @@ var controls = (function(){
brush.generate = controls.text.generate
brush.generate()
drawing = false
+ filling = false
selection.hide()
}
controls.text.generate = function(){
@@ -50,9 +53,15 @@ var controls = (function(){
controls.select = new Tool (select_el)
controls.select.use = function(){
drawing = false
+ filling = false
selection.show()
}
- controls.text.generate = function(){
+
+ controls.fill = new Tool (fill_el)
+ controls.fill.use = function(){
+ drawing = false
+ filling = true
+ selection.hide()
}
controls.clear = new Tool (clear_el)
@@ -137,6 +146,7 @@ var controls = (function(){
controls.square,
controls.circle,
controls.text,
+ controls.fill,
controls.select,
controls.clear,
controls.grid,