summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-12-18 23:21:00 -0500
committerJulie Lala <jules@okfoc.us>2014-12-18 23:21:00 -0500
commit6946255bb23b50e841a6684dc8950797d2a5dce6 (patch)
treed1390e405e5302bdbc03d115a6e20afae8469739 /js/tool.js
parentdda251707cd91ec5d377816de4ea7a6e3da4147e (diff)
parent8746a003b0226cd7bd67eca8fcf3774313021093 (diff)
merge
Diffstat (limited to 'js/tool.js')
-rw-r--r--js/tool.js42
1 files changed, 24 insertions, 18 deletions
diff --git a/js/tool.js b/js/tool.js
index b0bc536..190f29f 100644
--- a/js/tool.js
+++ b/js/tool.js
@@ -1,18 +1,24 @@
-function Tool (span) {
- this.lex = new Lex (span)
- this.name = span.innerHTML
- this.span = span
-}
-Tool.prototype.use = function(){}
-Tool.prototype.focus = function(){
- // focused && focused.blur()
- current_tool && current_tool.blur()
- current_tool = this
- this.span.classList.add('focused')
- this.use()
- if (this.name != 'shader') { cursor_input.focus() }
-}
-Tool.prototype.blur = function(){
- current_tool = null
- this.span.classList.remove('focused')
-}
+var Tool = Model({
+ init: function (span) {
+ this.el = span
+ this.lex = new Lex (span)
+ this.name = span.innerHTML
+ this.span = span
+ },
+ use: function(){},
+ focus: function(){
+ // focused && focused.blur()
+ current_tool && current_tool.blur()
+ current_tool = this
+ this.span.classList.add('focused')
+ this.use()
+ if (this.name != 'shader') { cursor_input.focus() }
+ },
+ blur: function(){
+ current_tool = null
+ this.span.classList.remove('focused')
+ }
+})
+
+var Checkbox = Tool.extend({
+})