summaryrefslogtreecommitdiff
path: root/js/tool.js
diff options
context:
space:
mode:
authortimb <opuscule@gmail.com>2015-07-11 07:09:33 -0700
committertimb <opuscule@gmail.com>2015-07-11 07:09:33 -0700
commit85a2862b92abc75a65ca79e55fb987a1af4bd337 (patch)
tree95e436f850b7347ee9d02bbd0da845bce81dbc56 /js/tool.js
parent600f28f73e13f5351f870833a0fd0dccba51afed (diff)
make current_filetool (shader, load, save, etc) operate independent of current_tool (brush, fill, etc)
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')