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/app.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/app.js') diff --git a/js/app.js b/js/app.js index e0b737d..0d91c84 100644 --- a/js/app.js +++ b/js/app.js @@ -6,6 +6,8 @@ var selecting = false var filling = false var changed = false var transforming = false +var mirror_x = false +var mirror_y = false var focused var canvas, tools, palette, controls, brush, mode -- 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/app.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 From 655c5293708300deaf11a8b6a924e7b817bf6288 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 31 Mar 2018 19:46:22 +0200 Subject: pankeizing --- css/sally.css | 28 +++++++++++++++++++++++++++- index.html | 44 ++++++++++++++++++++++---------------------- js/app.js | 2 +- js/ui/controls.js | 8 ++++++++ 4 files changed, 58 insertions(+), 24 deletions(-) (limited to 'js/app.js') diff --git a/css/sally.css b/css/sally.css index 978a78d..3661d12 100644 --- a/css/sally.css +++ b/css/sally.css @@ -42,12 +42,16 @@ a:hover { text-decoration: underline } #gallery_rapper { display: inline } +#ui_rapper .block { + width: 100px; +} .block { padding:4px; } .block:nth-child(n+2) { padding-left: 30px; } +#textarea_mode { padding: 4px; } .tool { cursor: pointer; } @@ -122,7 +126,7 @@ textarea { font-size:12pt; width: 37vw; height: 300px; background: #333; color: .vertical #canvas_rapper div, .vertical #tools_rapper, .vertical #palette_rapper, -.vertical #brush_container { display: inline-block; float: left} +.vertical #brush_container { display: inline-block; float: left; } .vertical #workspace_rapper { width: auto; position: relative; float: left; } .vertical #palette_rapper { margin-right: 10px; } .vertical #tools_block { min-width: 100%; } @@ -160,6 +164,7 @@ textarea { font-size:12pt; width: 37vw; height: 300px; background: #333; color: border: 1px solid; display: inline-block; margin-bottom: 13px; + float: left; } #letters_rapper { display: inline-block; @@ -226,3 +231,24 @@ textarea { font-size:12pt; width: 37vw; height: 300px; background: #333; color: 66% { color: hsl(320,100%,50%) } 100% { color: hsl(360,100%,50%) } } + +.can_save { + color: white; + text-decoration: underline; +} +.panke #shader_el, +.panke #load_el, +.panke #gallery_el, +.panke #import_textarea, +.panke #doc_el, +.panke #gallery_el, +.panke #save_button, +.panke #upload_button, +.panke #export_button, +.panke #username_input, +.panke #upload_input, +.panke #grid_el, +.panke #save_el, +.panke #vertical_checkbox, +.panke #add_custom_el, +.panke #format_el { display: none !important; } diff --git a/index.html b/index.html index 997638d..8c272eb 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ - +
@@ -35,14 +35,11 @@ x char

+ add -
-
- no
- paint
-
-
_ mirror x
_ mirror y
+
+
+
square
@@ -56,29 +53,33 @@ scale
translate
slice
-
-
-
-
- _ grid
+ + _ grid - x vertical
+ x vertical -
- brush size: 5 x 5
- canvas size: 100 x 30
shader - webcam - load + new
save - new - doc - gallery + > send to IRC
+ load + webcam
+ doc + gallery +
+
+
+ no
+ paint
+
+

+ brush: 5 x 5
+ canvas: 100 x 30
@@ -104,7 +105,6 @@
-
x diff --git a/js/app.js b/js/app.js index 5898f5c..64f8bea 100644 --- a/js/app.js +++ b/js/app.js @@ -82,7 +82,7 @@ function bind () { }) window.onbeforeunload = function() { - if (changed && !in_iframe()) return "You have edited this drawing." + // if (changed && !in_iframe()) return "You have edited this drawing." } function in_iframe () { diff --git a/js/ui/controls.js b/js/ui/controls.js index 8da4994..32a329a 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -164,6 +164,14 @@ var controls = (function(){ clipboard.show() clipboard.export_mode() } + controls.send_to_irc = new ClipboardTool (send_to_irc_el) + controls.send_to_irc.use = function(){ + changed && clipboard.upload_png() + clipboard.show() + clipboard.export_mode() + alert('your ascii art is now on display on the IRC channel inside the panke.gallery!') + } + controls.load = new ClipboardTool (load_el) controls.load.use = function(){ // console.log("use") -- cgit v1.2.3-70-g09d2