From c100fc5cc5e788912ebfe9612a4f4d36520eb2c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sat, 24 Nov 2018 13:06:52 +0100 Subject: [PATCH] index.html, assets/js/{app,gfx,ui/controls}.js: removes pointless brush [xy] mirroring `feature.' index.html, assets/{css/sally.css,js/{matrix,ui/controls}.js}: removes dead {rotate[d],pixels} code. index.html: cleanup UI layout. --- assets/css/sally.css | 14 -------------- assets/js/app.js | 2 -- assets/js/gfx.js | 34 ---------------------------------- assets/js/matrix.js | 19 ++++--------------- assets/js/ui/controls.js | 31 ------------------------------- index.html | 13 +++---------- 6 files changed, 7 insertions(+), 106 deletions(-) diff --git a/assets/css/sally.css b/assets/css/sally.css index 7dc5e7e..a82728e 100644 --- a/assets/css/sally.css +++ b/assets/css/sally.css @@ -76,13 +76,6 @@ a:hover { text-decoration: underline } } } span,a { min-width: 8px; line-height: 15px; display: inline-block; } -body.pixels { - line-height: 8px; -} -.pixels #brush_rapper span, -.pixels #brush_rapper a, -.pixels #canvas_rapper span, -.pixels #canvas_rapper a { line-height: 8px; overflow: hidden; } .rapper { cursor: crosshair; } body.grid span { border-right: 1px solid #444; border-bottom: 1px solid #444; } body.grid div { border-left: 1px solid #444; } @@ -132,13 +125,6 @@ textarea { font-size:12pt; width: 37vw; height: 300px; background: #333; color: .vertical #secret_rapper { margin-right: 10px; } .vertical #secret_rapper span { float: left; clear: both; } -.rotated #canvas_rapper { - transform: translateX(-50%) translateY(-50%) translateZ(0) rotate(-90deg); - transform-origin: 50% 50%; - position: absolute; - left: 50%; -} - #tools_block > * { cursor: crosshair; } diff --git a/assets/js/app.js b/assets/js/app.js index 38e49ec..b3179ce 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -6,8 +6,6 @@ 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 diff --git a/assets/js/gfx.js b/assets/js/gfx.js index a9d2f66..54678a9 100644 --- a/assets/js/gfx.js +++ b/assets/js/gfx.js @@ -115,27 +115,9 @@ var draw = (function(){ changed = true if (e.shiftKey) { line (lex, last_point, point, erasing) - if (mirror_x) { - line(lex, [w-last_point[0], last_point[1]], [w-point[0], point[1]], erasing) - } - if (mirror_y) { - line(lex, [last_point[0], h-last_point[1]], [point[0], h-point[1]], erasing) - } - if (mirror_x && mirror_y) { - line(lex, [w-last_point[0], h-last_point[1]], [w-point[0], h-point[1]], erasing) - } } else { stamp (canvas, brush, point[0], point[1], erasing) - if (mirror_x) { - stamp (canvas, brush, w-point[0], point[1], erasing) - } - if (mirror_y) { - stamp (canvas, brush, point[0], h-point[1], erasing) - } - if (mirror_x && mirror_y) { - stamp (canvas, brush, w-point[0], h-point[1], erasing) - } } last_point[0] = point[0] last_point[1] = point[1] @@ -149,16 +131,6 @@ var draw = (function(){ function move (e, lex, point) { var w = canvas.w, h = canvas.h line(lex, last_point, point, erasing) - if (mirror_x) { - line(lex, [w-last_point[0], last_point[1]], [w-point[0], point[1]], erasing) - } - if (mirror_y) { - line(lex, [last_point[0], h-last_point[1]], [point[0], h-point[1]], erasing) - } - if (mirror_x && mirror_y) { - line(lex, [w-last_point[0], h-last_point[1]], [w-point[0], h-point[1]], erasing) - } - last_point[0] = point[0] last_point[1] = point[1] } @@ -223,12 +195,6 @@ var draw = (function(){ var y_b = mod( point[1], h ) var last_point_mod = [x_b, y_b], point_mod = [x_a, y_a] line(lex, last_point_mod, point_mod, erasing) - // if (mirror_x) { - // line(lex, [w-last_point_mod[0], last_point_mod[1]], [w-point_mod[0], point_mod[1]], erasing) - // } - // if (mirror_y) { - // line(lex, [last_point_mod[0], h-last_point_mod[1]], [point_mod[0], h-point_mod[1]], erasing) - // } } last_point[0] = point[0] last_point[1] = point[1] diff --git a/assets/js/matrix.js b/assets/js/matrix.js index 032cecd..840ddf4 100644 --- a/assets/js/matrix.js +++ b/assets/js/matrix.js @@ -223,21 +223,10 @@ Matrix.prototype.resize_rapper = function(){ var width = cw * this.aa[0].length var height = ch * this.aa.length if (canvas.grid) { width++; height++ } - if (this.rotated) { - this.rapper.parentNode.classList.add("rotated") - this.rapper.parentNode.style.height = (width) + "px" - this.rapper.parentNode.style.width = (height) + "px" - this.rapper.style.top = (width/2) + "px" - // this.rapper.style.left = ((canvas_rapper.offsetHeight+20)/2) + "px" - } - else { - this.rapper.parentNode.classList.remove("rotated") - this.rapper.parentNode.style.height = "" - this.rapper.style.width = - this.rapper.parentNode.style.width = (width) + "px" - this.rapper.style.top = "" - // canvas_rapper.style.left = "auto" - } + this.rapper.parentNode.style.height = "" + this.rapper.style.width = + this.rapper.parentNode.style.width = (width) + "px" + this.rapper.style.top = "" } Matrix.prototype.ascii = function () { var lines = this.aa.map(function(row, y){ diff --git a/assets/js/ui/controls.js b/assets/js/ui/controls.js index 81df41b..96c7d3a 100644 --- a/assets/js/ui/controls.js +++ b/assets/js/ui/controls.js @@ -182,37 +182,6 @@ var controls = (function(){ this.update(brush.draw_char) } - // - -// controls.turn = new BlurredCheckbox (turn_checkbox) -// controls.turn.memorable = true -// controls.turn.use = function(state){ -// canvas.rotated = typeof state == "boolean" ? state : ! canvas.rotated -// canvas.resize_rapper() -// 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.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) controls.vertical.memorable = true controls.vertical.use = function(state){ diff --git a/index.html b/index.html index 2659442..a9bf160 100644 --- a/index.html +++ b/index.html @@ -26,14 +26,10 @@
-
x fg
x bg
x char
-
- + add - _ mirror x
- _ mirror y
+ + add



@@ -50,11 +46,6 @@ scale
translate
slice
- - _ grid - - x vertical -
@@ -66,6 +57,8 @@
brush: 5 x 5
canvas: 100 x 30
+ _ grid + x vertical