File saving updates

This commit is contained in:
Lewis Hemens 2014-03-23 19:55:46 +00:00
parent 463e5ee631
commit 864bd859f0
5 changed files with 124 additions and 103 deletions

View File

@ -16,6 +16,10 @@
color: #777; color: #777;
} }
a {
color: #FF9E20;
}
body { body {
margin: 0px; margin: 0px;
} }
@ -189,6 +193,14 @@ textarea {
margin-right: 5px; margin-right: 5px;
} }
#drive-filename {
font-size: 30px;
border: gray 1px solid;
padding: 5px;
background: #EEE;
cursor: pointer;
}
.fade-out { .fade-out {
opacity: 0; opacity: 0;
} }
@ -263,6 +275,7 @@ textarea {
<div id="drive-dialog" class="dialog"> <div id="drive-dialog" class="dialog">
<div id="drive-filename">Untitled ASCII Diagram</div> <div id="drive-filename">Untitled ASCII Diagram</div>
<div style="margin: 5px;">Edit file permissions in <a href="http://drive.google.com/">Google Drive</a>.</div>
<button class="close-dialog-button">Close</button> <button class="close-dialog-button">Close</button>
</div> </div>

View File

@ -36,11 +36,11 @@ function w(a) {
function x(a) { function x(a) {
return "+" == w(a); return "+" == w(a);
} }
function ca(a, b, c, d) { function ca(a, b, c, e) {
this.left = a; this.left = a;
this.right = b; this.right = b;
this.m = c; this.m = c;
this.j = d; this.j = e;
} }
function y(a) { function y(a) {
return a.left + a.right + a.m + a.j; return a.left + a.right + a.m + a.j;
@ -83,41 +83,41 @@ function fa(a) {
b.clearRect(0, 0, a.canvas.width, a.canvas.height); b.clearRect(0, 0, a.canvas.width, a.canvas.height);
b.scale(a.zoom, a.zoom); b.scale(a.zoom, a.zoom);
b.translate(a.canvas.width / 2 / a.zoom, a.canvas.height / 2 / a.zoom); b.translate(a.canvas.width / 2 / a.zoom, a.canvas.height / 2 / a.zoom);
var c = n(B(a, new l(0, 0)), new l(3, 3)), d = B(a, new l(a.canvas.width, a.canvas.height)).add(new l(3, 3)); var c = n(B(a, new l(0, 0)), new l(3, 3)), e = B(a, new l(a.canvas.width, a.canvas.height)).add(new l(3, 3));
b.lineWidth = "1"; b.lineWidth = "1";
b.strokeStyle = "#EEEEEE"; b.strokeStyle = "#EEEEEE";
b.beginPath(); b.beginPath();
for (var e = c.x;e < d.x;e++) { for (var d = c.x;d < e.x;d++) {
b.moveTo(9 * e - a.offset.x, 0 - a.offset.y), b.lineTo(9 * e - a.offset.x, 17 * a.state.cells.length - a.offset.y); b.moveTo(9 * d - a.offset.x, 0 - a.offset.y), b.lineTo(9 * d - a.offset.x, 17 * a.state.cells.length - a.offset.y);
} }
for (e = c.y;e < d.y;e++) { for (d = c.y;d < e.y;d++) {
b.moveTo(0 - a.offset.x, 17 * e - a.offset.y), b.lineTo(9 * a.state.cells.length - a.offset.x, 17 * e - a.offset.y); b.moveTo(0 - a.offset.x, 17 * d - a.offset.y), b.lineTo(9 * a.state.cells.length - a.offset.x, 17 * d - a.offset.y);
} }
a.context.stroke(); a.context.stroke();
e = !a.r; d = !a.r;
b.font = "15px Courier New"; b.font = "15px Courier New";
for (var g = c.x;g < d.x;g++) { for (var g = c.x;g < e.x;g++) {
for (var h = c.y;h < d.y;h++) { for (var k = c.y;k < e.y;k++) {
var k = C(a.state, new l(g, h)); var h = C(a.state, new l(g, k));
if (x(k) || null != k.f && " " != w(k)) { if (x(h) || null != h.f && " " != w(h)) {
a.context.fillStyle = null != k.f ? "#DEF" : "#F5F5F5", b.fillRect(9 * g - a.offset.x, 17 * (h - 1) - a.offset.y, 9, 17); a.context.fillStyle = null != h.f ? "#DEF" : "#F5F5F5", b.fillRect(9 * g - a.offset.x, 17 * (k - 1) - a.offset.y, 9, 17);
} }
var t = F(a.state, new l(g, h)); var t = F(a.state, new l(g, k));
null == t || x(k) && !e || (a.context.fillStyle = "#000000", b.fillText(t, 9 * g - a.offset.x, 17 * h - a.offset.y - 3)); null == t || x(h) && !d || (a.context.fillStyle = "#000000", b.fillText(t, 9 * g - a.offset.x, 17 * k - a.offset.y - 3));
} }
} }
if (a.r) { if (a.r) {
b.lineWidth = "1"; b.lineWidth = "1";
b.strokeStyle = "#000000"; b.strokeStyle = "#000000";
b.beginPath(); b.beginPath();
for (e = c.x;e < d.x;e++) { for (d = c.x;d < e.x;d++) {
for (k = !1, g = c.y;g < d.y;g++) { for (h = !1, g = c.y;g < e.y;g++) {
h = C(a.state, new l(e, g)), x(h) && g != d.y - 1 || !k || (b.moveTo(9 * e - a.offset.x + 4.5, 17 * k - a.offset.y - 8.5), b.lineTo(9 * e - a.offset.x + 4.5, 17 * (g - 1) - a.offset.y - 8.5), k = !1), x(h) && !k && (k = g); k = C(a.state, new l(d, g)), x(k) && g != e.y - 1 || !h || (b.moveTo(9 * d - a.offset.x + 4.5, 17 * h - a.offset.y - 8.5), b.lineTo(9 * d - a.offset.x + 4.5, 17 * (g - 1) - a.offset.y - 8.5), h = !1), x(k) && !h && (h = g);
} }
} }
for (g = c.y;g < d.y;g++) { for (g = c.y;g < e.y;g++) {
for (k = !1, e = c.x;e < d.x;e++) { for (h = !1, d = c.x;d < e.x;d++) {
h = C(a.state, new l(e, g)), x(h) && e != d.x - 1 || !k || (b.moveTo(9 * k - a.offset.x + 4.5, 17 * g - a.offset.y - 8.5), b.lineTo(9 * (e - 1) - a.offset.x + 4.5, 17 * g - a.offset.y - 8.5), k = !1), x(h) && !k && (k = e); k = C(a.state, new l(d, g)), x(k) && d != e.x - 1 || !h || (b.moveTo(9 * h - a.offset.x + 4.5, 17 * g - a.offset.y - 8.5), b.lineTo(9 * (d - 1) - a.offset.x + 4.5, 17 * g - a.offset.y - 8.5), h = !1), x(k) && !h && (h = d);
} }
} }
a.context.stroke(); a.context.stroke();
@ -126,19 +126,19 @@ function fa(a) {
function B(a, b) { function B(a, b) {
return new l(Math.min(Math.max(1, Math.round(((new l((b.x - a.canvas.width / 2) / a.zoom + a.offset.x, (b.y - a.canvas.height / 2) / a.zoom + a.offset.y)).x - 4.5) / 9)), 1998), Math.min(Math.max(1, Math.round(((new l((b.x - a.canvas.width / 2) / a.zoom + a.offset.x, (b.y - a.canvas.height / 2) / a.zoom + a.offset.y)).y + 8.5) / 17)), 598)); return new l(Math.min(Math.max(1, Math.round(((new l((b.x - a.canvas.width / 2) / a.zoom + a.offset.x, (b.y - a.canvas.height / 2) / a.zoom + a.offset.y)).x - 4.5) / 9)), 1998), Math.min(Math.max(1, Math.round(((new l((b.x - a.canvas.width / 2) / a.zoom + a.offset.x, (b.y - a.canvas.height / 2) / a.zoom + a.offset.y)).y + 8.5) / 17)), 598));
} }
;function G(a, b, c, d, e) { ;function G(a, b, c, e, d) {
e = e || "+"; d = d || "+";
var g = Math.min(b.x, c.x), h = Math.min(b.y, c.y), k = Math.max(b.x, c.x), t = Math.max(b.y, c.y), u = d ? c.x : b.x; var g = Math.min(b.x, c.x), k = Math.min(b.y, c.y), h = Math.max(b.x, c.x), t = Math.max(b.y, c.y), u = e ? c.x : b.x;
for (d = d ? b.y : c.y;g++ < k;) { for (e = e ? b.y : c.y;g++ < h;) {
var P = new l(g, d), E = a.getContext(new l(g, d)); var P = new l(g, e), E = a.getContext(new l(g, e));
" " == e && 2 == E.m + E.j || H(a, P, e); " " == d && 2 == E.m + E.j || H(a, P, d);
} }
for (;h++ < t;) { for (;k++ < t;) {
P = new l(u, h), E = a.getContext(new l(u, h)), " " == e && 2 == E.left + E.right || H(a, P, e); P = new l(u, k), E = a.getContext(new l(u, k)), " " == d && 2 == E.left + E.right || H(a, P, d);
} }
I(a, b, e); I(a, b, d);
I(a, c, e); I(a, c, d);
H(a, new l(u, d), e); H(a, new l(u, e), d);
} }
function J(a) { function J(a) {
this.state = a; this.state = a;
@ -232,8 +232,8 @@ O.prototype.l = function() {
O.prototype.e = function() { O.prototype.e = function() {
var a = $("#text-tool-input").val(); var a = $("#text-tool-input").val();
K(this.state); K(this.state);
for (var b = 0, c = 0, d = 0;d < a.length;d++) { for (var b = 0, c = 0, e = 0;e < a.length;e++) {
"\n" == a[d] ? (c++, b = 0) : (I(this.state, this.g.add(new l(b, c)), a[d]), b++); "\n" == a[e] ? (c++, b = 0) : (I(this.state, this.g.add(new l(b, c)), a[e]), b++);
} }
}; };
function Q(a) { function Q(a) {
@ -249,9 +249,9 @@ Q.prototype.move = function(a) {
this.g = a; this.g = a;
var b = Math.min(this.a.x, this.g.x); var b = Math.min(this.a.x, this.g.x);
a = Math.min(this.a.y, this.g.y); a = Math.min(this.a.y, this.g.y);
for (var c = Math.max(this.a.x, this.g.x), d = Math.max(this.a.y, this.g.y);b <= c;b++) { for (var c = Math.max(this.a.x, this.g.x), e = Math.max(this.a.y, this.g.y);b <= c;b++) {
for (var e = a;e <= d;e++) { for (var d = a;d <= e;d++) {
I(this.state, new l(b, e), "\u2009"); I(this.state, new l(b, d), "\u2009");
} }
} }
}; };
@ -269,10 +269,10 @@ function R(a) {
} }
R.prototype.start = function(a) { R.prototype.start = function(a) {
if (f && !x(C(this.state, a))) { if (f && !x(C(this.state, a))) {
var b = v.concat([p.add(r), p.add(s), q.add(r), q.add(s)]), c = null, d = 0, e; var b = v.concat([p.add(r), p.add(s), q.add(r), q.add(s)]), c = null, e = 0, d;
for (e in b) { for (d in b) {
var g = a.add(b[e]), h = y(this.state.getContext(g)); var g = a.add(b[d]), k = y(this.state.getContext(g));
x(C(this.state, g)) && h > d && (c = b[e], d = h); x(C(this.state, g)) && k > e && (c = b[d], e = k);
} }
a = null == c ? a : a.add(c); a = null == c ? a : a.add(c);
} }
@ -281,14 +281,14 @@ R.prototype.start = function(a) {
if (x(C(this.state, this.a))) { if (x(C(this.state, this.a))) {
this.state.getContext(this.a); this.state.getContext(this.a);
a = []; a = [];
for (var k in v) { for (var h in v) {
var b = ga(this, this.a, v[k]), t; var b = ga(this, this.a, v[h]), t;
for (t in b) { for (t in b) {
if (c = b[t], d = 0 != v[k].x, 1 == y(this.state.getContext(c))) { if (c = b[t], e = 0 != v[h].x, 1 == y(this.state.getContext(c))) {
a.push({position:c, t:d}); a.push({position:c, t:e});
} else { } else {
for (var u in v) { for (var u in v) {
0 != v[k].add(v[u]).length() && 2 != v[k].add(v[u]).length() && (e = ga(this, c, v[u]), 0 != e.length && a.push({position:e[e.length - 1], t:d})); 0 != v[h].add(v[u]).length() && 2 != v[h].add(v[u]).length() && (d = ga(this, c, v[u]), 0 != d.length && a.push({position:d[d.length - 1], t:e}));
} }
} }
} }
@ -310,13 +310,13 @@ R.prototype.end = function() {
L(this.state); L(this.state);
}; };
function ga(a, b, c) { function ga(a, b, c) {
for (var d = b.clone(), e = [];;) { for (var e = b.clone(), d = [];;) {
var g = d.add(c); var g = e.add(c);
if (!x(C(a.state, g))) { if (!x(C(a.state, g))) {
return m(b, d) || e.push(d), e; return m(b, e) || d.push(e), d;
} }
d = g; e = g;
3 == y(a.state.getContext(d)) && e.push(d); 3 == y(a.state.getContext(e)) && d.push(e);
} }
} }
R.prototype.l = function(a) { R.prototype.l = function(a) {
@ -349,9 +349,9 @@ function C(a, b) {
return a.cells[b.x][b.y]; return a.cells[b.x][b.y];
} }
function I(a, b, c) { function I(a, b, c) {
var d = C(a, b); var e = C(a, b);
a.i.push(new ea(b, d)); a.i.push(new ea(b, e));
d.f = c; e.f = c;
a.d = !0; a.d = !0;
} }
function H(a, b, c) { function H(a, b, c) {
@ -372,37 +372,37 @@ function F(a, b) {
return c.left && c.right && !c.m && !c.j ? "\u2013" : !c.left && !c.right && c.m && c.j ? "|" : c.left && c.right && c.m && c.j ? "\u2013" : "+"; return c.left && c.right && !c.m && !c.j ? "\u2013" : !c.left && !c.right && c.m && c.j ? "|" : c.left && c.right && c.m && c.j ? "\u2013" : "+";
} }
S.prototype.getContext = function(a) { S.prototype.getContext = function(a) {
var b = x(C(this, a.add(p))), c = x(C(this, a.add(q))), d = x(C(this, a.add(r))); var b = x(C(this, a.add(p))), c = x(C(this, a.add(q))), e = x(C(this, a.add(r)));
a = x(C(this, a.add(s))); a = x(C(this, a.add(s)));
return new ca(b, c, d, a); return new ca(b, c, e, a);
}; };
function L(a, b) { function L(a, b) {
var c = [], d = a.i.map(function(a) { var c = [], e = a.i.map(function(a) {
return a.position.x.toString() + a.position.y.toString(); return a.position.x.toString() + a.position.y.toString();
}), e = a.i.filter(function(a, b) { }), d = a.i.filter(function(a, b) {
return d.indexOf(d[b]) == b; return e.indexOf(e[b]) == b;
}); });
a.i.length = 0; a.i.length = 0;
for (var g in e) { for (var g in d) {
var h = e[g].C; var k = d[g].C;
c.push(new da(e[g].position, null != h.value ? h.value : " ")); c.push(new da(d[g].position, null != k.value ? k.value : " "));
var k = w(h); var h = w(k);
if ("\u2009" == k || " " == k) { if ("\u2009" == h || " " == h) {
k = null; h = null;
} }
h.f = null; k.f = null;
h.value = k; k.value = h;
} }
e = b ? a.A : a.B; d = b ? a.A : a.B;
0 < c.length && (50 < e.length && e.shift(), e.push(c)); 0 < c.length && (50 < d.length && d.shift(), d.push(c));
a.d = !0; a.d = !0;
} }
function ha(a) { function ha(a) {
if (0 != a.B.length) { if (0 != a.B.length) {
var b = a.B.pop(), c; var b = a.B.pop(), c;
for (c in b) { for (c in b) {
var d = b[c]; var e = b[c];
I(a, d.position, d.value); I(a, e.position, e.value);
} }
L(a, !0); L(a, !0);
} }
@ -411,38 +411,41 @@ function ia(a) {
if (0 != a.A.length) { if (0 != a.A.length) {
var b = a.A.pop(), c; var b = a.A.pop(), c;
for (c in b) { for (c in b) {
var d = b[c]; var e = b[c];
I(a, d.position, d.value); I(a, e.position, e.value);
} }
L(a); L(a);
} }
} }
function T(a) { function T(a) {
for (var b = new l(Number.MAX_VALUE, Number.MAX_VALUE), c = new l(-1, -1), d = 0;d < a.cells.length;d++) { for (var b = new l(Number.MAX_VALUE, Number.MAX_VALUE), c = new l(-1, -1), e = 0;e < a.cells.length;e++) {
for (var e = 0;e < a.cells[d].length;e++) { for (var d = 0;d < a.cells[e].length;d++) {
null != w(a.cells[d][e]) && (d < b.x && (b.x = d), e < b.y && (b.y = e), d > c.x && (c.x = d), e > c.y && (c.y = e)); null != w(a.cells[e][d]) && (e < b.x && (b.x = e), d < b.y && (b.y = d), e > c.x && (c.x = e), d > c.y && (c.y = d));
} }
} }
if (0 > c.x) { if (0 > c.x) {
return ""; return "";
} }
for (var g = "", e = b.y;e <= c.y;e++) { for (var g = "", d = b.y;d <= c.y;d++) {
for (var h = "", d = b.x;d <= c.x;d++) { for (var k = "", e = b.x;e <= c.x;e++) {
var k = F(a, new l(d, e)), h = h + (null == k ? " " : k) var h = F(a, new l(e, d)), k = k + (null == h ? " " : h)
} }
g += h.replace("\\s+$/g", "") + "\n"; g += k.replace("\\s+$/g", "") + "\n";
} }
return g; return g;
} }
function ja(a, b, c) { function ja(a, b, c) {
b = b.split("\n"); b = b.split("\n");
for (var d = 0;d < b.length;d++) { for (var e = new l(0, Math.round(b.length / 2)), d = 0;d < b.length;d++) {
for (var e = b[d], g = 0;g < e.length;g++) { e.x = Math.max(e.x, Math.round(b[d].length / 2));
var h = e.charAt(g); }
for (d = 0;d < b.length;d++) {
for (var g = b[d], k = 0;k < g.length;k++) {
var h = g.charAt(k);
if ("\u2013" == h || "|" == h) { if ("\u2013" == h || "|" == h) {
h = "+"; h = "+";
} }
I(a, (new l(g, d)).add(c), h); I(a, n((new l(k, d)).add(c), e), h);
} }
} }
L(a); L(a);
@ -508,7 +511,7 @@ U.prototype.n = function() {
}.bind(this)); }.bind(this));
$("#import-submit-button").click(function() { $("#import-submit-button").click(function() {
this.state.clear(); this.state.clear();
ja(this.state, $("#import-area").val(), B(this.view, new l(this.view.canvas.width / 4, this.view.canvas.height / 4))); ja(this.state, $("#import-area").val(), B(this.view, new l(this.view.canvas.width / 2, this.view.canvas.height / 2)));
$("#import-area").val(""); $("#import-area").val("");
}.bind(this)); }.bind(this));
$("#use-lines-button").click(function() { $("#use-lines-button").click(function() {
@ -606,16 +609,16 @@ ka.prototype.save = function() {
}.bind(this)); }.bind(this));
}; };
function pa(a) { function pa(a) {
1 < window.location.hash.length && window.gapi.client.request({path:"/drive/v2/files/" + window.location.hash.substr(1, window.location.hash.length - 1), method:"GET"}).execute(function(a) { 1 < window.location.hash.length && ($("#drive-save-state").text("Loading..."), window.gapi.client.request({path:"/drive/v2/files/" + window.location.hash.substr(1, window.location.hash.length - 1), method:"GET"}).execute(function(a) {
qa(this, a); qa(this, a);
sa(this); sa(this);
}.bind(a)); }.bind(a)));
} }
function sa(a) { function sa(a) {
ta(a.file.downloadUrl, function(a) { ta(a.file.downloadUrl, function(a) {
window.console.log(a); $("#drive-save-state").text("Loaded");
this.state.clear(); this.state.clear();
ja(this.state, a, B(this.view, new l(this.view.canvas.width / 4, this.view.canvas.height / 4))); ja(this.state, a, B(this.view, new l(this.view.canvas.width / 2, this.view.canvas.height / 2)));
}.bind(a)); }.bind(a));
} }
function ra(a, b) { function ra(a, b) {
@ -623,16 +626,16 @@ function ra(a, b) {
return window.gapi.client.request({path:"/upload/drive/v2/files" + (null == a.file ? "" : "/" + a.file.id), method:null == a.file ? "POST" : "PUT", params:{uploadType:"multipart"}, headers:{"Content-Type":'multipart/mixed; boundary="-------314159265358979323846"'}, body:c}); return window.gapi.client.request({path:"/upload/drive/v2/files" + (null == a.file ? "" : "/" + a.file.id), method:null == a.file ? "POST" : "PUT", params:{uploadType:"multipart"}, headers:{"Content-Type":'multipart/mixed; boundary="-------314159265358979323846"'}, body:c});
} }
function ta(a, b) { function ta(a, b) {
var c = window.gapi.auth.getToken().access_token, d = new XMLHttpRequest; var c = window.gapi.auth.getToken().access_token, e = new XMLHttpRequest;
d.open("GET", a); e.open("GET", a);
d.setRequestHeader("Authorization", "Bearer " + c); e.setRequestHeader("Authorization", "Bearer " + c);
d.onload = function() { e.onload = function() {
b(d.responseText); b(e.responseText);
}; };
d.onerror = function() { e.onerror = function() {
b(null); b(null);
}; };
d.send(); e.send();
} }
;function ua(a) { ;function ua(a) {
this.b = a; this.b = a;

View File

@ -116,8 +116,8 @@ ascii.Controller.prototype.installBindings = function() {
this.state.clear(); this.state.clear();
this.state.fromText($('#import-area').val(), this.state.fromText($('#import-area').val(),
this.view.screenToCell(new ascii.Vector( this.view.screenToCell(new ascii.Vector(
this.view.canvas.width / 4, this.view.canvas.width / 2,
this.view.canvas.height / 4))); this.view.canvas.height / 2)));
$('#import-area').val(''); $('#import-area').val('');
}.bind(this)); }.bind(this));

View File

@ -129,6 +129,7 @@ ascii.DriveController.prototype.save = function() {
ascii.DriveController.prototype.loadFromHash = function() { ascii.DriveController.prototype.loadFromHash = function() {
if (window.location.hash.length > 1) { if (window.location.hash.length > 1) {
$('#drive-save-state').text('Loading...');
var fileId = window.location.hash.substr(1, window.location.hash.length - 1); var fileId = window.location.hash.substr(1, window.location.hash.length - 1);
this.getLoadRequest(fileId).execute(function(result) { this.getLoadRequest(fileId).execute(function(result) {
this.handleFile(result); this.handleFile(result);
@ -139,11 +140,11 @@ ascii.DriveController.prototype.loadFromHash = function() {
ascii.DriveController.prototype.reloadFileContent = function() { ascii.DriveController.prototype.reloadFileContent = function() {
this.downloadFile(this.file['downloadUrl'], function(content) { this.downloadFile(this.file['downloadUrl'], function(content) {
window.console.log(content); $('#drive-save-state').text('Loaded');
this.state.clear(); this.state.clear();
this.state.fromText(content, this.view.screenToCell(new ascii.Vector( this.state.fromText(content, this.view.screenToCell(new ascii.Vector(
this.view.canvas.width / 4, this.view.canvas.width / 2,
this.view.canvas.height / 4))); this.view.canvas.height / 2)));
}.bind(this)); }.bind(this));
}; };

View File

@ -234,12 +234,16 @@ ascii.State.prototype.outputText = function() {
}; };
/** /**
* Loads the given text into the diagram starting at the given offset. * Loads the given text into the diagram starting at the given offset (centered).
* @param {string} value * @param {string} value
* @param {ascii.Vector} offset * @param {ascii.Vector} offset
*/ */
ascii.State.prototype.fromText = function(value, offset) { ascii.State.prototype.fromText = function(value, offset) {
var lines = value.split('\n'); var lines = value.split('\n');
var middle = new ascii.Vector(0, Math.round(lines.length / 2));
for (var j = 0; j < lines.length; j++) {
middle.x = Math.max(middle.x, Math.round(lines[j].length / 2));
}
for (var j = 0; j < lines.length; j++) { for (var j = 0; j < lines.length; j++) {
var line = lines[j]; var line = lines[j];
for (var i = 0; i < line.length; i++) { for (var i = 0; i < line.length; i++) {
@ -250,7 +254,7 @@ ascii.State.prototype.fromText = function(value, offset) {
if (char == SPECIAL_LINE_H || char == SPECIAL_LINE_V) { if (char == SPECIAL_LINE_H || char == SPECIAL_LINE_V) {
char = SPECIAL_VALUE; char = SPECIAL_VALUE;
} }
this.drawValue(new ascii.Vector(i, j).add(offset), char); this.drawValue(new ascii.Vector(i, j).add(offset).subtract(middle), char);
} }
} }
this.commitDraw(); this.commitDraw();