From 43b82e648535b3e919443b9778f3f9f4e3c11675 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 12 Feb 2015 11:20:43 -0500 Subject: fix ascii import --- js/clipboard.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/clipboard.js b/js/clipboard.js index 0acc3c7..535e333 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -116,8 +116,11 @@ var clipboard = (function () { import_text: function () { var data = import_textarea.value lines = data.split("\n") - var width = lines.reduce(function(a,b){ return Math.max(a, b.length) }) + console.log(data) + console.log(lines) + var width = lines.reduce(function(a,b){ console.log(a,b); return Math.max(a, b.length) }, 0) var height = lines.length +console.log(width, height) if (width > 200) { return alert("input too wide") } -- cgit v1.2.3-70-g09d2 From 9a525a25fdb43bc1be866d8b4a50afee7b384c59 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 12 Feb 2015 12:26:52 -0500 Subject: kenny logginz --- js/clipboard.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'js') diff --git a/js/clipboard.js b/js/clipboard.js index 535e333..66df875 100644 --- a/js/clipboard.js +++ b/js/clipboard.js @@ -116,11 +116,8 @@ var clipboard = (function () { import_text: function () { var data = import_textarea.value lines = data.split("\n") - console.log(data) - console.log(lines) var width = lines.reduce(function(a,b){ console.log(a,b); return Math.max(a, b.length) }, 0) var height = lines.length -console.log(width, height) if (width > 200) { return alert("input too wide") } -- cgit v1.2.3-70-g09d2 From d67f7095d4d3f061431d9ec88996cda0e9b00267 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 13 Feb 2015 12:41:40 -0500 Subject: adding hues --- js/color_code.js | 40 +++++++++++++++++++++++++++++++++++++++- js/util.js | 4 ++++ 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/color_code.js b/js/color_code.js index 55a284f..c8e8b84 100644 --- a/js/color_code.js +++ b/js/color_code.js @@ -18,7 +18,42 @@ var MircColor = (function(){ [127,127,127], [210,210,210] ] - + var HUES = [ + [255,255,255], + [0,0,0], + [0,0,127], + [0,147,0], + [255,0,0], + [127,0,0], + [156,0,156], + [252,127,0], + [255,255,0], + [0,252,0], + [0,147,147], + [0,255,255], + [0,0,252], + [255,0,255], + null, + null, + ] + var GRAYS = [ + [255,255,255], + [0,0,0], + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + [127,127,127], + [210,210,210] + ] function closest_to(pixel){ return COLORS.reduce(function(prev, curr, index) { var d = distance(pixel, curr) @@ -31,6 +66,7 @@ var MircColor = (function(){ } function distance(u, v){ + if (! v) return Math.Infinity var r = u[0] - v[0] var g = u[1] - v[1] var b = u[2] - v[2] @@ -137,6 +173,8 @@ var MircColor = (function(){ return { colors: COLORS, + hues: HUES, + grays: GRAYS, closest_to: closest_to, distance: distance, fromUrl: fromUrl, diff --git a/js/util.js b/js/util.js index 91055f9..81e8f60 100644 --- a/js/util.js +++ b/js/util.js @@ -115,6 +115,10 @@ function weave(a){ reverse(aa[1]).forEach(function(el){ b.push(el) }) return b } +function cssRule (selector, declaration) { + var x = document.styleSheets, y = x.length-1; + x[y].insertRule(selector+"{"+declaration+"}", x[y].cssRules.length); +} // easing functions function circular (t) { return Math.sqrt( 1 - ( --t * t ) ) } -- cgit v1.2.3-70-g09d2 From 5b7549932c55ebe7388258fb19b65a907dd5d3d1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 18 Feb 2015 13:07:21 -0500 Subject: dont break the thing if you click one of the width/height fields --- css/sally.css | 2 +- js/ui/controls.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/css/sally.css b/css/sally.css index 6fdbe55..a3ffc1a 100644 --- a/css/sally.css +++ b/css/sally.css @@ -59,7 +59,7 @@ body { transition: 0.1s linear; } textarea { font-size:12pt; width: 42%; height: 300px; background: #333; color: #0f0; border: 0; font-family: 'FixedsysExcelsior301Regular'; outline: 0; border: 1px solid #333; background:#010;} #shader_rapper { display: none; } #import_rapper { display: none; } -#cursor_input { position: absolute; top: 0; right: 0; width:30px; opacity: 0; } +#cursor_input { position: fixed; top: 0; right: 0; width:30px; opacity: 0; } .selector_el { border: 1px dashed #fff !important; padding-top: 1px; diff --git a/js/ui/controls.js b/js/ui/controls.js index 6f0fb91..485f690 100644 --- a/js/ui/controls.js +++ b/js/ui/controls.js @@ -203,14 +203,15 @@ var controls = (function(){ controls.canvas_width.key = int_key(function(n, keyCode){ controls.canvas_width.read() - if (controls.canvas_width.char.length == 1) { + if (controls.canvas_width.char.length < 3) { n = parseInt(controls.canvas_width.char) * 10 + n } controls.canvas_width.char = ""+n controls.canvas_width.build() }) controls.canvas_width.onBlur = function(){ - var w = parseInt(controls.canvas_width.char) || 1 + var w = parseInt(controls.canvas_width.char) + if (! w) return; controls.canvas_width.char = w+"" controls.canvas_width.build() canvas.resize(w, canvas.h) @@ -225,7 +226,8 @@ var controls = (function(){ controls.canvas_height.build() }) controls.canvas_height.onBlur = function(){ - var h = parseInt(controls.canvas_height.char) || 1 + var h = parseInt(controls.canvas_height.char) + if (! h) return; controls.canvas_height.char = h+"" controls.canvas_height.build() canvas.resize(canvas.w, h) -- cgit v1.2.3-70-g09d2