From 85a2862b92abc75a65ca79e55fb987a1af4bd337 Mon Sep 17 00:00:00 2001 From: timb Date: Sat, 11 Jul 2015 07:09:33 -0700 Subject: make current_filetool (shader, load, save, etc) operate independent of current_tool (brush, fill, etc) --- js/app.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'js/app.js') diff --git a/js/app.js b/js/app.js index a98ee84..f73a447 100644 --- a/js/app.js +++ b/js/app.js @@ -7,7 +7,8 @@ var filling = false var changed = false var focused -var canvas, tools, palette, controls, brush, mode, current_tool, current_canvas +var canvas, tools, palette, controls, brush, mode +var current_tool, current_filetool, current_canvas function init () { build() @@ -44,9 +45,16 @@ function bind () { window.addEventListener('mouseup', function(e){ dragging = erasing = false - if (current_tool.name != 'shader' && current_tool.name != 'load' && current_tool.name != 'save' && is_desktop) { + // if (current_filetool.name != 'shader' && current_filetool.name != 'load' && current_filetool.name != 'save' && is_desktop) { + // cursor_input.focus() + // } + + var ae = document.activeElement + + if (ae !== shader_textarea && ae !== import_textarea) { cursor_input.focus() } + if (selecting) { selection.up(e) } @@ -56,11 +64,11 @@ function bind () { }) window.addEventListener('mousedown', function(e){ - if (current_tool.name != 'shader' && is_desktop) { cursor_input.focus() } + // if (current_filetool.name != 'shader' && is_desktop) { cursor_input.focus() } }) document.addEventListener('DOMContentLoaded', function(){ - if (current_tool.name != 'shader' && is_desktop) { cursor_input.focus() } + if (is_desktop) { cursor_input.focus() } document.body.classList.remove('loading') }) -- cgit v1.2.3-70-g09d2