summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-12-09 23:11:58 -0500
committerJules Laplace <jules@okfoc.us>2014-12-09 23:11:58 -0500
commit151db2336cce17e7623a9e105799e72bc842e7fe (patch)
tree62c0c6f5f486bb0206f26f1b1bcca728235d8194 /js/tool.js
parentd63f63cf41e5fdb0ba609d6aec4d25585d5ac068 (diff)
adding fishbone.js
Diffstat (limited to 'js/tool.js')
-rw-r--r--js/tool.js43
1 files changed, 24 insertions, 19 deletions
diff --git a/js/tool.js b/js/tool.js
index 9cbc107..e1c6adb 100644
--- a/js/tool.js
+++ b/js/tool.js
@@ -1,19 +1,24 @@
-function Tool (span) {
- this.el = 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({
+})