diff options
Diffstat (limited to 'js/tool.js')
| -rw-r--r-- | js/tool.js | 45 |
1 files changed, 33 insertions, 12 deletions
@@ -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') |
