summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tool.js')
-rw-r--r--js/tool.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/tool.js b/js/tool.js
new file mode 100644
index 0000000..3b9b803
--- /dev/null
+++ b/js/tool.js
@@ -0,0 +1,16 @@
+function Tool (span) {
+ this.lex = new Lex (span)
+ 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()
+}
+Tool.prototype.blur = function(){
+ current_tool = null
+ this.span.classList.remove('focused')
+}