summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-06-03 19:07:49 -0400
committerJules Laplace <jules@okfoc.us>2015-06-03 19:07:49 -0400
commit142807d8ea506e792dd662ca67ad3a6d49659b57 (patch)
treeef590093c0ad5c6187a5a31697efbf3959994a53 /js/tool.js
parent6cb13ad54e3d807a181285fc7b1befa55b0bc264 (diff)
fix some weird focus issues
Diffstat (limited to 'js/tool.js')
-rw-r--r--js/tool.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/tool.js b/js/tool.js
index 81ab43b..2953dbc 100644
--- a/js/tool.js
+++ b/js/tool.js
@@ -9,6 +9,7 @@ var Tool = Model({
done: function(){},
focus: function(){
// focused && focused.blur()
+ console.log("focusing ", this.name)
current_tool && current_tool.blur()
current_tool = this
this.span.classList.add('focused')
@@ -17,6 +18,7 @@ var Tool = Model({
},
blur: function(){
current_tool = null
+ console.log("blurring ", this.name)
this.span.classList.remove('focused')
this.done()
}
@@ -37,15 +39,35 @@ 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
+ }
this.use()
if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
+ },
+ blur: function(){
+ console.log("blurring ", this.name)
+ this.span.classList.remove('focused')
+ this.done()
}
})
var BlurredTool = Tool.extend({
focus: function(){
+ if (current_tool.name == "shader") {
+ shader.toggle(false)
+ current_tool.blur()
+ current_tool = controls.circle
+ }
this.use()
if (this.name != 'shader' && is_desktop) { cursor_input.focus() }
+ },
+ blur: function(){
+ console.log("blurring ", this.name)
+ this.span.classList.remove('focused')
+ this.done()
}
})