summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-07-13 07:43:19 -0400
committerJules Laplace <jules@okfoc.us>2015-07-13 07:43:19 -0400
commit9a45b4474fc906c698c7cb39b60e22c0132716bb (patch)
tree92c725365f46096ba0dc97c912bf66fa1a40547b /js/tool.js
parent72a690a40dd1727065e28b1ce0bca743283f54c7 (diff)
parent5cc0340723278a1b8f39a6c46b8cf3201f47ec50 (diff)
Merge branch 'master' of lmno:ascii
Diffstat (limited to 'js/tool.js')
-rw-r--r--js/tool.js45
1 files changed, 33 insertions, 12 deletions
diff --git a/js/tool.js b/js/tool.js
index 360e79f..c3fc67c 100644
--- a/js/tool.js
+++ b/js/tool.js
@@ -22,6 +22,27 @@ var Tool = Model({
}
})
+var FileTool = Tool.extend({
+
+ focus: function(){
+ if (current_filetool === this) {
+ this.blur()
+ return
+ }
+ current_filetool && current_filetool.blur()
+ current_filetool = this
+ this.span.classList.add('focused')
+ this.use()
+ console.log("focus")
+ if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
+ },
+ blur: function(){
+ current_filetool = null
+ this.span.classList.remove('focused')
+ this.done()
+ }
+})
+
var Checkbox = Tool.extend({
init: function (span){
this.__init(span)
@@ -39,13 +60,13 @@ var Checkbox = Tool.extend({
var BlurredCheckbox = Checkbox.extend({
focus: function(){
- if (current_tool.name == "shader") {
- shader.toggle(false)
- current_tool.blur()
- current_tool = controls.circle
- }
+ // if (current_filetool && current_filetool.name == "shader") {
+ // shader.toggle(false)
+ // current_tool.blur()
+ // current_tool = controls.circle
+ // }
this.use()
- if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
+ // if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
},
blur: function(){
this.span.classList.remove('focused')
@@ -55,13 +76,13 @@ var BlurredCheckbox = Checkbox.extend({
var BlurredTool = Tool.extend({
focus: function(){
- if (current_tool.name == "shader") {
- shader.toggle(false)
- current_tool.blur()
- current_tool = controls.circle
- }
+ // if (current_filetool && current_filetool.name == "shader") {
+ // shader.toggle(false)
+ // current_tool.blur()
+ // current_tool = controls.circle
+ // }
this.use()
- if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
+ // if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
},
blur: function(){
this.span.classList.remove('focused')