From bfec7a220ae55ab88e80f5b8f79919ba235be54b Mon Sep 17 00:00:00 2001 From: Lewis Hemens Date: Sun, 23 Mar 2014 12:50:45 +0000 Subject: [PATCH] Fixed bug with releases firing without presses --- index.html | 16 ++++++++++++++-- js-compiled.js | 28 ++++++++++++++-------------- js-lib/controller.js | 2 +- js-lib/input-controller.js | 4 ++-- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 73e2675..750433d 100644 --- a/index.html +++ b/index.html @@ -38,7 +38,7 @@ body { z-index: 100; } -button { +#draw-tools > button, #file-tools > button { vertical-align: top; display: inline-block; margin: 5px; @@ -120,6 +120,17 @@ button.active, .info-icon { display: inline-block; } +.close-dialog-button, #import-submit-button, #text-tool-close { + position: absolute; + right: 0px; + bottom: 0px; + margin: 5px; +} + +#import-submit-button { + margin-right: 70px; +} + #ascii-canvas { position: fixed; left: 0px; @@ -223,9 +234,10 @@ textarea {
Drag out an area to erase.

Resize boxes and lines, just drag a line to change it.

Press where to start writing, and type the text you want.

+

To move around the screen, hold CTRL on desktop and drag. On mobile, drag quickly to move and press and hold to start drawing.

- +
diff --git a/js-compiled.js b/js-compiled.js index 1ef4593..06cfb60 100644 --- a/js-compiled.js +++ b/js-compiled.js @@ -51,7 +51,7 @@ function da(a, b) { } function ea(a, b) { this.position = a; - this.A = b; + this.B = b; } ;function z(a) { this.state = a; @@ -328,8 +328,8 @@ function T() { this.cells = Array(2E3); this.i = []; this.d = !0; + this.A = []; this.w = []; - this.v = []; for (var a = 0;a < this.cells.length;a++) { this.cells[a] = Array(600); for (var b = 0;b < this.cells[a].length;b++) { @@ -359,7 +359,7 @@ function H(a, b, c) { } function K(a) { for (var b in a.i) { - a.i[b].A.f = null; + a.i[b].B.f = null; } a.i.length = 0; } @@ -384,7 +384,7 @@ function L(a, b) { }); a.i.length = 0; for (var g in d) { - var k = d[g].A; + var k = d[g].B; c.push(new da(d[g].position, null != k.value ? k.value : " ")); var h = w(k); if ("\u2009" == h || " " == h) { @@ -393,13 +393,13 @@ function L(a, b) { k.f = null; k.value = h; } - d = b ? a.v : a.w; + d = b ? a.w : a.A; 0 < c.length && (50 < d.length && d.shift(), d.push(c)); a.d = !0; } function U(a) { - if (0 != a.w.length) { - var b = a.w.pop(), c; + if (0 != a.A.length) { + var b = a.A.pop(), c; for (c in b) { var e = b[c]; I(a, e.position, e.value); @@ -408,8 +408,8 @@ function U(a) { } } function V(a) { - if (0 != a.v.length) { - var b = a.v.pop(), c; + if (0 != a.w.length) { + var b = a.w.pop(), c; for (c in b) { var e = b[c]; I(a, e.position, e.value); @@ -455,7 +455,7 @@ W.prototype.p = function(a) { this.o = b; }; function X(a) { - (a.mode = 2) && a.c.end(); + 2 == a.mode && a.c.end(); a.mode = 0; a.t = null; a.u = null; @@ -623,11 +623,11 @@ function Y(a) { this.n(); } function ma(a, b) { - a.B = b; + a.v = b; a.F = $.now(); a.k = !1; window.setTimeout(function() { - if (!this.k && !this.r) { + if (!this.k && !this.r && null != this.v) { var a = this.b; a.mode = 2; a.c.start(B(a.view, b)); @@ -635,7 +635,7 @@ function ma(a, b) { }.bind(a), 130); } Y.prototype.p = function(a) { - if (!this.k && 130 > $.now() - this.F && 3 < n(a, this.B).length()) { + if (!this.k && 130 > $.now() - this.F && 3 < n(a, this.v).length()) { this.k = !0; var b = this.b; b.mode = 1; @@ -646,7 +646,7 @@ Y.prototype.p = function(a) { }; Y.prototype.reset = function() { this.r = this.k = !1; - this.B = null; + this.v = null; }; Y.prototype.n = function() { var a = this.b.view.canvas; diff --git a/js-lib/controller.js b/js-lib/controller.js index 4c3c67f..36b746c 100644 --- a/js-lib/controller.js +++ b/js-lib/controller.js @@ -81,7 +81,7 @@ ascii.Controller.prototype.handleMove = function(position) { * Ends the current operation. */ ascii.Controller.prototype.endAll = function() { - if (this.mode = Mode.DRAW) { + if (this.mode == Mode.DRAW) { this.drawFunction.end(); } // Cleanup state. diff --git a/js-lib/input-controller.js b/js-lib/input-controller.js index bb48af8..ed3efcd 100644 --- a/js-lib/input-controller.js +++ b/js-lib/input-controller.js @@ -81,9 +81,9 @@ ascii.TouchController.prototype.handlePress = function(position) { this.pressTimestamp = $.now(); this.dragStarted = false; - // If a drag didn't start, then handle it as a draw. + // If a drag or zoom didn't start and if we didn't release already, then handle it as a draw. window.setTimeout(function() { - if (!this.dragStarted && !this.zoomStarted) { + if (!this.dragStarted && !this.zoomStarted && this.pressVector != null) { this.controller.startDraw(position); } }.bind(this), DRAG_LATENCY);