From 8752354fa9b2b8c03b47b33a75e0ca95e8335d97 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Tue, 18 Aug 2015 08:41:40 -0400 Subject: check if changed before autouploading, hide filetool, other stuff.. --- js/ui/controls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/ui') diff --git a/js/ui/controls.js b/js/ui/controls.js index a21e293..c191cc2 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -72,6 +72,7 @@ var controls = (function(){ undo.new() undo.save_rect(0, 0, canvas.w, canvas.h) canvas.erase() + current_filetool && current_filetool.blur() } controls.webcam = new FileTool (webcam_el) @@ -119,9 +120,9 @@ var controls = (function(){ }) controls.save = new ClipboardTool (save_el) controls.save.use = function(){ + changed && clipboard.upload_png() clipboard.show() clipboard.export_mode() - clipboard.upload_png() } controls.load = new ClipboardTool (load_el) controls.load.use = function(){ -- cgit v1.2.3-70-g09d2 From cfbc275f16e0bb48cc31b61abe086798d8059dda Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 26 Dec 2015 22:47:27 -0500 Subject: adding mouse.x/y --- js/app.js | 1 + js/ui/canvas.js | 2 ++ 2 files changed, 3 insertions(+) (limited to 'js/ui') diff --git a/js/app.js b/js/app.js index a96cc35..3531d7c 100644 --- a/js/app.js +++ b/js/app.js @@ -9,6 +9,7 @@ var focused var canvas, tools, palette, controls, brush, mode var current_tool, current_filetool, current_canvas +var mouse = { x: 0, y: 0 } function init () { build() diff --git a/js/ui/canvas.js b/js/ui/canvas.js index e241fd1..75b8f97 100644 --- a/js/ui/canvas.js +++ b/js/ui/canvas.js @@ -52,6 +52,8 @@ var canvas = current_canvas = (function(){ }) lex.span.addEventListener("mousemove", function(e){ + mouse.x = x + mouse.y = y if (is_mobile) return if (! dragging) return if (drawing) { -- cgit v1.2.3-70-g09d2 From b55c277f18a56cb6c6f85df968111f230e828b07 Mon Sep 17 00:00:00 2001 From: timb Date: Sun, 13 Mar 2016 17:46:43 -0700 Subject: rm lex.fill since it is exactly the same fn as lex.assign --- js/lex.js | 7 ------- js/matrix.js | 2 +- js/ui/brush.js | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'js/ui') diff --git a/js/lex.js b/js/lex.js index 70dd2bf..b0d6007 100644 --- a/js/lex.js +++ b/js/lex.js @@ -84,13 +84,6 @@ Lex.prototype.erase = function (){ this.opacity = 1 this.build() } -Lex.prototype.fill = function(lex){ - this.fg = lex.fg - this.bg = lex.bg - this.char = lex.char - this.opacity = lex.opacity - this.build() -} Lex.prototype.eq = function(lex){ return lex && this.fg == lex.fg && this.bg == lex.bg && this.char == lex.char } diff --git a/js/matrix.js b/js/matrix.js index 4c8976c..275e6b6 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -112,7 +112,7 @@ Matrix.prototype.fill = function(lex){ this.char = lex.char this.opacity = lex.opacity this.forEach(function(el,x,y){ - el.fill(lex) + el.assign(lex) el.build() }) } diff --git a/js/ui/brush.js b/js/ui/brush.js index 8cc858f..668538f 100644 --- a/js/ui/brush.js +++ b/js/ui/brush.js @@ -41,7 +41,7 @@ var brush = (function(){ } else { fillColor = brush.bg - lex.fill(brush) + lex.assign(brush) } brush.focus(x, y) }) @@ -55,7 +55,7 @@ var brush = (function(){ lex.clear() } else { - lex.fill(brush) + lex.assign(brush) } brush.focus(x, y) }) -- cgit v1.2.3-70-g09d2