summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/tool.js2
-rw-r--r--js/ui/controls.js27
2 files changed, 16 insertions, 13 deletions
diff --git a/js/tool.js b/js/tool.js
index 3bd397c..d31472b 100644
--- a/js/tool.js
+++ b/js/tool.js
@@ -6,6 +6,7 @@ var Tool = Model({
this.span = span
},
use: function(){},
+ done: function(){},
focus: function(){
// focused && focused.blur()
current_tool && current_tool.blur()
@@ -17,6 +18,7 @@ var Tool = Model({
blur: function(){
current_tool = null
this.span.classList.remove('focused')
+ this.done()
}
})
diff --git a/js/ui/controls.js b/js/ui/controls.js
index 3f92b08..982871a 100644
--- a/js/ui/controls.js
+++ b/js/ui/controls.js
@@ -8,7 +8,6 @@ var controls = (function(){
brush.generate()
drawing = true
filling = false
- selection.hide()
brush.modified = false
}
controls.cross.generate = function(){
@@ -27,8 +26,6 @@ var controls = (function(){
brush.generate = controls.circle.generate
brush.generate()
drawing = true
- filling = false
- selection.hide()
brush.modified = false
}
controls.circle.generate = function(){
@@ -44,6 +41,9 @@ var controls = (function(){
}
})
}
+ controls.circle.done = function(){
+ drawing = false
+ }
controls.square = new Tool (square_el)
controls.square.use = function(){
@@ -51,37 +51,39 @@ var controls = (function(){
brush.generate()
brush.modified = false
drawing = true
- filling = false
- selection.hide()
}
controls.square.generate = function(){
var fg = brush.fg, bg = brush.bg
brush.fill(fg,bg)
}
+ controls.square.done = function(){
+ drawing = false
+ }
controls.text = new Tool (text_el)
controls.text.use = function(){
brush.generate = controls.text.generate
brush.generate()
- drawing = false
- filling = false
- selection.hide()
}
controls.text.generate = function(){
}
controls.select = new Tool (select_el)
controls.select.use = function(){
- drawing = false
- filling = false
selection.show()
}
+ controls.select.done = function(){
+ selection.hide()
+ }
controls.fill = new Tool (fill_el)
controls.fill.use = function(){
- drawing = false
filling = true
- selection.hide()
+ document.body.classList.add("bucket")
+ }
+ controls.fill.done = function(){
+ filling = false
+ document.body.classList.remove("bucket")
}
controls.clear = new Tool (clear_el)
@@ -91,7 +93,6 @@ var controls = (function(){
controls.grid = new Checkbox (grid_el)
controls.grid.use = function(){
- selection.hide()
document.body.classList.toggle('grid')
this.update( document.body.classList.contains("grid") )
}