summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-05-05 03:12:24 -0400
committerJules Laplace <jules@okfoc.us>2015-05-05 03:12:24 -0400
commit1908b82d0bfa01267e623636b5bd0aca82a6ce82 (patch)
tree5e925da250930cec2c6bb623313ed6211c2ff626
parentf07fd39e67df3618c97dd38480488e62ca91ef9e (diff)
bucket
-rw-r--r--css/sally.css3
-rw-r--r--img/bucket.pngbin0 -> 1219 bytes
-rw-r--r--js/tool.js2
-rw-r--r--js/ui/controls.js27
4 files changed, 19 insertions, 13 deletions
diff --git a/css/sally.css b/css/sally.css
index c015305..e9fb35b 100644
--- a/css/sally.css
+++ b/css/sally.css
@@ -82,6 +82,9 @@ textarea { font-size:12pt; width: 37%; height: 300px; background: #333; color: #
.dropper #canvas_rapper {
cursor: url(../img/dropper.gif) 0 15, auto;
}
+.bucket #canvas_rapper {
+ cursor: url(../img/bucket.png) 3 15, auto;
+}
#cursor_input { position: fixed; top: 0; right: 0; width:30px; opacity: 0; }
.selector_el {
border: 1px dashed #fff !important;
diff --git a/img/bucket.png b/img/bucket.png
new file mode 100644
index 0000000..cfaab30
--- /dev/null
+++ b/img/bucket.png
Binary files differ
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") )
}