diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-07-13 07:43:19 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-07-13 07:43:19 -0400 |
| commit | 9a45b4474fc906c698c7cb39b60e22c0132716bb (patch) | |
| tree | 92c725365f46096ba0dc97c912bf66fa1a40547b /js/tool.js | |
| parent | 72a690a40dd1727065e28b1ce0bca743283f54c7 (diff) | |
| parent | 5cc0340723278a1b8f39a6c46b8cf3201f47ec50 (diff) | |
Merge branch 'master' of lmno:ascii
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') |
