From 96660020d88c8b85dec87a95a974de0ae07bdaed Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 6 May 2015 02:51:56 -0400 Subject: fix some blur issues --- js/ui/controls.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'js/ui') diff --git a/js/ui/controls.js b/js/ui/controls.js index e666464..b1b1eb4 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -72,12 +72,14 @@ var controls = (function(){ document.body.classList.remove("bucket") } - controls.clear = new Tool (clear_el) + controls.clear = new BlurredTool (clear_el) controls.clear.use = function(){ - canvas.erase() + if (confirm("really delete this colorcode?")) { + canvas.erase() + } } - controls.webcam = new Tool (webcam_el) + controls.webcam = new BlurredTool (webcam_el) controls.webcam.load = function(){ this.loaded = true webcam_close.addEventListener("click", function(){ controls.webcam.blur() }) @@ -101,7 +103,7 @@ var controls = (function(){ webcam_rapper.style.display = "none" } - controls.grid = new Checkbox (grid_el) + controls.grid = new BlurredCheckbox (grid_el) controls.grid.use = function(){ document.body.classList.toggle('grid') this.update( document.body.classList.contains("grid") ) @@ -135,14 +137,17 @@ var controls = (function(){ // ShaderTool = Tool.extend({ - use: function(){ - shader_rapper.style.display = "block" - shader_textarea.focus() + active: false, + use: function(state){ + this.active = typeof state == "boolean" ? state : ! this.active + if (this.active) { + shader_rapper.style.display = "block" + shader_textarea.focus() + } + else { + shader_rapper.style.display = "none" + } }, - blur: function(){ - this.__blur() - shader_rapper.style.display = "none" - } }) controls.shader = new ShaderTool (shader_el) shader_textarea.value = demo_shader.innerHTML @@ -164,19 +169,19 @@ var controls = (function(){ // - controls.fg = new Checkbox (fg_checkbox) + controls.fg = new BlurredCheckbox (fg_checkbox) controls.fg.use = function(state){ brush.draw_fg = state || ! brush.draw_fg this.update(brush.draw_fg) } - controls.bg = new Checkbox (bg_checkbox) + controls.bg = new BlurredCheckbox (bg_checkbox) controls.bg.use = function(state){ brush.draw_bg = state || ! brush.draw_bg this.update(brush.draw_bg) } - controls.char = new Checkbox (char_checkbox) + controls.char = new BlurredCheckbox (char_checkbox) controls.char.use = function(state){ brush.draw_char = state || ! brush.draw_char this.update(brush.draw_char) -- cgit v1.2.3-70-g09d2