From d9f1628cbc3e96c584279b8d58e2e2c2a0d75b56 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 31 Mar 2018 13:12:41 +0200 Subject: mirror x/y --- js/ui/controls.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/ui/controls.js') diff --git a/js/ui/controls.js b/js/ui/controls.js index 1dd83c7..8ffdc64 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -270,6 +270,17 @@ var controls = (function(){ this.update(canvas.pixels) } + controls.mirror_x = new BlurredCheckbox (mirror_x_checkbox) + controls.mirror_x.use = function(state){ + window.mirror_x = typeof state == "boolean" ? state : ! window.mirror_x + this.update(window.mirror_x) + } + controls.mirror_y = new BlurredCheckbox (mirror_y_checkbox) + controls.mirror_y.use = function(state){ + window.mirror_y = typeof state == "boolean" ? state : ! window.mirror_y + this.update(window.mirror_y) + } + // controls.vertical = new BlurredCheckbox (vertical_checkbox) -- cgit v1.2.3-70-g09d2 From 5605ce481f6c5f67bce69ff31ffe0117485efc39 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 31 Mar 2018 17:58:21 +0200 Subject: upload ascii when saving --- index.html | 2 +- js/app.js | 10 +++++++++- js/clipboard.js | 2 +- js/ui/controls.js | 14 +++++++------- js/upload.js | 3 ++- 5 files changed, 20 insertions(+), 11 deletions(-) (limited to 'js/ui/controls.js') diff --git a/index.html b/index.html index 5ef9c5f..1098f4c 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@ _ grid
x vertical
- _ pixels
+
brush size: 5 x 5
canvas size: 100 x 30
diff --git a/js/app.js b/js/app.js index 0d91c84..5898f5c 100644 --- a/js/app.js +++ b/js/app.js @@ -82,7 +82,15 @@ function bind () { }) window.onbeforeunload = function() { - if (changed) return "You have edited this drawing." + if (changed && !in_iframe()) return "You have edited this drawing." + } + + function in_iframe () { + try { + return window.self !== window.top; + } catch (e) { + return true; + } } } diff --git a/js/clipboard.js b/js/clipboard.js index ecb200b..107f634 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -236,7 +236,7 @@ var clipboard = (function () { var blob = PNG.canvas_to_blob_with_colorcode(canvas_out, canvas.mirc()) var filename = clipboard.filename() var tag = 'ascii' - upload(blob, filename, tag) + upload(blob, filename, tag, canvas_out) } clipboard.export_canvas(upload_fn) } diff --git a/js/ui/controls.js b/js/ui/controls.js index 8ffdc64..8da4994 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -262,13 +262,13 @@ var controls = (function(){ // this.update(canvas.rotated) // } - controls.pixels = new BlurredCheckbox (pixels_checkbox) - controls.pixels.memorable = true - controls.pixels.use = function(state){ - canvas.pixels = typeof state == "boolean" ? state : ! canvas.pixels - document.body.classList.toggle("pixels", canvas.pixels) - this.update(canvas.pixels) - } + // controls.pixels = new BlurredCheckbox (pixels_checkbox) + // controls.pixels.memorable = true + // controls.pixels.use = function(state){ + // canvas.pixels = typeof state == "boolean" ? state : ! canvas.pixels + // document.body.classList.toggle("pixels", canvas.pixels) + // this.update(canvas.pixels) + // } controls.mirror_x = new BlurredCheckbox (mirror_x_checkbox) controls.mirror_x.use = function(state){ diff --git a/js/upload.js b/js/upload.js index c1ef7f7..0fa567c 100644 --- a/js/upload.js +++ b/js/upload.js @@ -3,7 +3,7 @@ var upload = (function(){ var button = document.getElementById("upload_button") var uploading = false - function upload(blob, filename, tag){ + function upload(blob, filename, tag, ascii){ if (uploading) return filename = filename || get_filename() tag = tag || "shader" @@ -15,6 +15,7 @@ var upload = (function(){ uploadImage({ blob: blob, + ascii: ascii, filename: filename, username: user.username, tag: tag, -- cgit v1.2.3-70-g09d2