2014-05-07 20:58:40 +00:00
|
|
|
var g;
|
2014-02-24 23:51:05 +00:00
|
|
|
try {
|
|
|
|
throw 1;
|
|
|
|
} catch (aa) {
|
2014-04-27 13:30:54 +00:00
|
|
|
window.U = window.U || {};
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
var h = ["+", "\u2012", "\u2013", "-", "|"], m = [">", "<", "^", "v"], ba = h.concat(m), n = "ontouchstart" in window || "onmsgesturechange" in window;
|
2014-04-27 12:20:23 +00:00
|
|
|
function p(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.x = a;
|
|
|
|
this.y = b;
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function q(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
return null != b && a.x == b.x && a.y == b.y;
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function r(a, b) {
|
|
|
|
return new p(a.x - b.x, a.y - b.y);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
p.prototype.add = function(a) {
|
|
|
|
return new p(this.x + a.x, this.y + a.y);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
p.prototype.clone = function() {
|
|
|
|
return new p(this.x, this.y);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
p.prototype.length = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
p.prototype.scale = function(a) {
|
|
|
|
return new p(this.x * a, this.y * a);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
function t(a, b) {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.w = Math.min(a.x, b.x);
|
|
|
|
this.A = Math.min(a.y, b.y);
|
2014-04-27 11:29:34 +00:00
|
|
|
this.I = Math.max(a.x, b.x);
|
|
|
|
this.J = Math.max(a.y, b.y);
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function ca(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
return new p(a.w, a.A);
|
2014-04-07 22:28:20 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
t.prototype.contains = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
return a.x >= this.w && a.x <= this.I && a.y >= this.A && a.y <= this.J;
|
2014-04-07 22:28:20 +00:00
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
var v = new p(-1, 0), w = new p(1, 0), x = new p(0, -1), y = new p(0, 1), A = [v, w, x, y];
|
|
|
|
function da() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.h = this.value = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function B(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
return null != a.h ? a.h : a.value;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function C(a) {
|
|
|
|
return-1 != ba.indexOf(B(a));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
function ea(a, b, c, d) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.left = a;
|
|
|
|
this.right = b;
|
2014-05-07 20:58:40 +00:00
|
|
|
this.k = c;
|
|
|
|
this.i = d;
|
2014-04-27 13:30:54 +00:00
|
|
|
this.P = this.L = this.Q = this.M = !1;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function D(a) {
|
|
|
|
return a.left + a.right + a.k + a.i;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function fa(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.position = a;
|
|
|
|
this.value = b;
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function ga(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.position = a;
|
2014-04-07 22:28:20 +00:00
|
|
|
this.n = b;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
;function ha(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
|
|
|
this.canvas = document.getElementById("ascii-canvas");
|
|
|
|
this.context = this.canvas.getContext("2d");
|
|
|
|
this.zoom = 1;
|
2014-04-27 12:20:23 +00:00
|
|
|
this.offset = new p(9E3, 5100);
|
2014-04-27 12:57:15 +00:00
|
|
|
this.f = !0;
|
|
|
|
this.B = !1;
|
2014-04-27 13:30:54 +00:00
|
|
|
ia(this);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function ia(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
a.canvas.width = document.documentElement.clientWidth;
|
|
|
|
a.canvas.height = document.documentElement.clientHeight;
|
2014-04-27 12:57:15 +00:00
|
|
|
a.f = !0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
ha.prototype.animate = function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
if (this.f || this.state.f) {
|
2014-04-27 13:30:54 +00:00
|
|
|
this.f = !1, this.state.f = !1, ja(this);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
var a = this;
|
|
|
|
window.requestAnimationFrame(function() {
|
|
|
|
a.animate();
|
|
|
|
});
|
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
function ja(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
var b = a.context;
|
|
|
|
b.setTransform(1, 0, 0, 1, 0, 0);
|
|
|
|
b.clearRect(0, 0, a.canvas.width, a.canvas.height);
|
|
|
|
b.scale(a.zoom, a.zoom);
|
|
|
|
b.translate(a.canvas.width / 2 / a.zoom, a.canvas.height / 2 / a.zoom);
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = r(E(a, new p(0, 0)), new p(3, 3)), d = E(a, new p(a.canvas.width, a.canvas.height)).add(new p(3, 3));
|
2014-04-27 13:30:54 +00:00
|
|
|
c.x = Math.max(0, Math.min(c.x, 2E3));
|
2014-05-07 20:58:40 +00:00
|
|
|
d.x = Math.max(0, Math.min(d.x, 2E3));
|
2014-04-27 13:30:54 +00:00
|
|
|
c.y = Math.max(0, Math.min(c.y, 600));
|
2014-05-07 20:58:40 +00:00
|
|
|
d.y = Math.max(0, Math.min(d.y, 600));
|
2014-02-24 23:51:05 +00:00
|
|
|
b.lineWidth = "1";
|
|
|
|
b.strokeStyle = "#EEEEEE";
|
|
|
|
b.beginPath();
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var e = c.x;e < d.x;e++) {
|
2014-03-23 22:12:53 +00:00
|
|
|
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);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
for (e = c.y;e < d.y;e++) {
|
2014-03-23 22:12:53 +00:00
|
|
|
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);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
a.context.stroke();
|
2014-04-27 12:57:15 +00:00
|
|
|
e = !a.B;
|
2014-02-25 00:30:25 +00:00
|
|
|
b.font = "15px Courier New";
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var f = c.x;f < d.x;f++) {
|
|
|
|
for (var l = c.y;l < d.y;l++) {
|
|
|
|
var k = F(a.state, new p(f, l));
|
2014-04-27 13:30:54 +00:00
|
|
|
if (C(k) || null != k.h && " " != B(k)) {
|
2014-05-07 20:58:40 +00:00
|
|
|
a.context.fillStyle = null != k.h ? "#DEF" : "#F5F5F5", b.fillRect(9 * f - a.offset.x, 17 * (l - 1) - a.offset.y, 9, 17);
|
2014-03-10 22:54:02 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
var s = G(a.state, new p(f, l));
|
|
|
|
null == s || C(k) && !e || (a.context.fillStyle = "#000000", b.fillText(s, 9 * f - a.offset.x, 17 * l - a.offset.y - 3));
|
2014-03-10 22:54:02 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
if (a.B) {
|
2014-03-10 22:54:02 +00:00
|
|
|
b.lineWidth = "1";
|
|
|
|
b.strokeStyle = "#000000";
|
|
|
|
b.beginPath();
|
2014-05-07 20:58:40 +00:00
|
|
|
for (e = c.x;e < d.x;e++) {
|
|
|
|
for (k = !1, f = c.y;f < d.y;f++) {
|
|
|
|
l = F(a.state, new p(e, f)), C(l) && f != 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 * (f - 1) - a.offset.y - 8.5), k = !1), C(l) && !k && (k = f);
|
2014-03-10 22:54:02 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
for (f = c.y;f < d.y;f++) {
|
|
|
|
for (k = !1, e = c.x;e < d.x;e++) {
|
|
|
|
l = F(a.state, new p(e, f)), C(l) && e != d.x - 1 || !k || (b.moveTo(9 * k - a.offset.x + 4.5, 17 * f - a.offset.y - 8.5), b.lineTo(9 * (e - 1) - a.offset.x + 4.5, 17 * f - a.offset.y - 8.5), k = !1), C(l) && !k && (k = e);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-03-10 22:54:02 +00:00
|
|
|
a.context.stroke();
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function E(a, b) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return new p(Math.min(Math.max(1, Math.round(((new p((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 p((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));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
;function I(a, b, c, d, e) {
|
2014-03-23 22:12:53 +00:00
|
|
|
e = e || "+";
|
2014-05-07 20:58:40 +00:00
|
|
|
var f = new t(b, c), l = f.w, k = f.A, s = f.I, f = f.J, z = d ? c.x : b.x;
|
|
|
|
for (d = d ? b.y : c.y;l++ < s;) {
|
|
|
|
var u = new p(l, d), H = a.getContext(new p(l, d));
|
2014-04-27 13:30:54 +00:00
|
|
|
" " == e && 2 == H.k + H.i || J(a, u, e);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
for (;k++ < f;) {
|
2014-04-27 13:30:54 +00:00
|
|
|
u = new p(z, k), H = a.getContext(new p(z, k)), " " == e && 2 == H.left + H.right || J(a, u, e);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
K(a, b, e);
|
2014-05-07 20:58:40 +00:00
|
|
|
K(a, c, e);
|
|
|
|
J(a, new p(z, d), e);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
function L(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
|
|
|
this.a = null;
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = L.prototype;
|
|
|
|
g.start = function(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.a = a;
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 11:29:34 +00:00
|
|
|
this.b = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
|
|
|
I(this.state, this.a, a, !0);
|
|
|
|
I(this.state, this.a, a, !1);
|
2014-03-10 22:55:38 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
return "crosshair";
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:57:15 +00:00
|
|
|
function O(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
2014-04-27 13:30:54 +00:00
|
|
|
this.V = b;
|
2014-02-24 23:51:05 +00:00
|
|
|
this.a = null;
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = O.prototype;
|
|
|
|
g.start = function(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.a = a;
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
2014-05-07 20:58:40 +00:00
|
|
|
var b = this.state.getContext(this.a), c = this.state.getContext(a);
|
|
|
|
I(this.state, this.a, a, b.k && b.i || c.left && c.right);
|
2014-04-27 13:30:54 +00:00
|
|
|
this.V && K(this.state, a, "^");
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
return "crosshair";
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function ka(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
|
|
|
this.value = b;
|
2014-04-27 12:20:23 +00:00
|
|
|
n && ($("#freeform-tool-input").val(""), $("#freeform-tool-input").hide(0, function() {
|
2014-03-23 12:25:03 +00:00
|
|
|
$("#freeform-tool-input").show(0, function() {
|
|
|
|
$("#freeform-tool-input").focus();
|
|
|
|
});
|
|
|
|
}));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = ka.prototype;
|
|
|
|
g.start = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
K(this.state, a, this.value);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
K(this.state, a, this.value);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
return "crosshair";
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function(a) {
|
2014-04-27 12:20:23 +00:00
|
|
|
n && (this.value = $("#freeform-tool-input").val().substr(0, 1), $("#freeform-tool-input").blur(), $("#freeform-tool-input").hide(0));
|
2014-02-24 23:51:05 +00:00
|
|
|
1 == a.length && (this.value = a);
|
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function la(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
2014-03-23 11:52:12 +00:00
|
|
|
this.a = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = la.prototype;
|
|
|
|
g.start = function(a) {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-03-23 11:52:12 +00:00
|
|
|
$("#text-tool-input").val("");
|
|
|
|
this.a = a;
|
2014-04-27 13:30:54 +00:00
|
|
|
a = B(F(this.state, this.a));
|
2014-04-27 12:57:15 +00:00
|
|
|
K(this.state, this.a, null == a ? "\u2009" : a);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 11:29:34 +00:00
|
|
|
null != this.a && (this.b = this.a, this.a = null, $("#text-tool-widget").hide(0, function() {
|
2014-03-23 11:52:12 +00:00
|
|
|
$("#text-tool-widget").show(0, function() {
|
|
|
|
$("#text-tool-input").focus();
|
|
|
|
});
|
|
|
|
}));
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function() {
|
2014-03-23 11:52:12 +00:00
|
|
|
return "pointer";
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function() {
|
2014-03-23 11:52:12 +00:00
|
|
|
var a = $("#text-tool-input").val();
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var b = 0, c = 0, d = 0;d < a.length;d++) {
|
|
|
|
"\n" == a[d] ? (c++, b = 0) : (K(this.state, this.b.add(new p(b, c)), a[d]), b++);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
};
|
2014-04-27 12:57:15 +00:00
|
|
|
function P(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
2014-04-27 11:29:34 +00:00
|
|
|
this.b = this.a = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = P.prototype;
|
|
|
|
g.start = function(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.a = a;
|
|
|
|
this.move(a);
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
2014-04-27 11:29:34 +00:00
|
|
|
this.b = a;
|
|
|
|
var b = Math.min(this.a.x, this.b.x);
|
|
|
|
a = Math.min(this.a.y, this.b.y);
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var c = Math.max(this.a.x, this.b.x), d = Math.max(this.a.y, this.b.y);b <= c;b++) {
|
|
|
|
for (var e = a;e <= d;e++) {
|
2014-04-27 12:57:15 +00:00
|
|
|
K(this.state, new p(b, e), "\u2009");
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
return "crosshair";
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function ma(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.e = this.a = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = ma.prototype;
|
|
|
|
g.start = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
var b;
|
|
|
|
if (n) {
|
2014-04-27 13:30:54 +00:00
|
|
|
if (C(F(this.state, a))) {
|
2014-04-27 12:57:15 +00:00
|
|
|
b = a;
|
|
|
|
} else {
|
2014-04-27 13:30:54 +00:00
|
|
|
b = A.concat([v.add(x), v.add(y), w.add(x), w.add(y)]);
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = null, d = 0, e;
|
2014-04-27 12:57:15 +00:00
|
|
|
for (e in b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var f = a.add(b[e]), l = D(this.state.getContext(f));
|
|
|
|
C(F(this.state, f)) && l > d && (c = b[e], d = l);
|
2014-04-27 12:57:15 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
b = null == c ? a : a.add(c);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
} else {
|
|
|
|
b = a;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
this.a = b;
|
|
|
|
this.e = null;
|
2014-04-27 13:30:54 +00:00
|
|
|
if (C(F(this.state, this.a))) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.state.getContext(this.a);
|
2014-04-27 12:57:15 +00:00
|
|
|
b = [];
|
2014-04-27 13:30:54 +00:00
|
|
|
for (var k in A) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = na(this, this.a, A[k]), s;
|
|
|
|
for (s in c) {
|
|
|
|
if (d = c[s], e = 0 != A[k].x, f = -1 != m.indexOf(B(F(this.state, a))), l = -1 != m.indexOf(B(F(this.state, d))), 1 == D(this.state.getContext(d))) {
|
|
|
|
b.push({position:d, o:e, T:f, S:l});
|
2014-02-24 23:51:05 +00:00
|
|
|
} else {
|
2014-04-27 13:30:54 +00:00
|
|
|
for (var z in A) {
|
|
|
|
if (0 != A[k].add(A[z]).length() && 2 != A[k].add(A[z]).length()) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var u = na(this, d, A[z]);
|
|
|
|
0 != u.length && (u = u[0], b.push({position:u, o:e, T:f, W:l, S:-1 != m.indexOf(B(F(this.state, u)))}));
|
2014-04-27 12:57:15 +00:00
|
|
|
}
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
this.e = b;
|
2014-02-24 23:51:05 +00:00
|
|
|
this.move(this.a);
|
|
|
|
}
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
|
|
|
for (var b in this.e) {
|
|
|
|
I(this.state, this.a, this.e[b].position, this.e[b].o, " ");
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
for (b in this.e) {
|
|
|
|
I(this.state, a, this.e[b].position, this.e[b].o);
|
|
|
|
}
|
|
|
|
for (b in this.e) {
|
2014-04-27 13:30:54 +00:00
|
|
|
this.e[b].T && K(this.state, a, "^"), this.e[b].S && K(this.state, this.e[b].position, "^"), this.e[b].W && K(this.state, new p(this.e[b].o ? this.e[b].position.x : a.x, this.e[b].o ? a.y : this.e[b].position.y), "^");
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
function na(a, b, c) {
|
|
|
|
for (var d = b.clone(), e = [];;) {
|
|
|
|
var f = d.add(c);
|
|
|
|
if (!C(F(a.state, f))) {
|
|
|
|
return q(b, d) || e.push(d), e;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
d = f;
|
|
|
|
3 == D(a.state.getContext(d)) && e.push(d);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
return C(F(this.state, a)) ? "pointer" : "default";
|
2014-04-07 22:28:20 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function() {
|
2014-04-07 22:28:20 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function oa(a) {
|
2014-04-07 22:28:20 +00:00
|
|
|
this.state = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.F = this.p = this.b = this.a = null;
|
2014-04-27 11:29:34 +00:00
|
|
|
this.K = !0;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.v = null;
|
2014-04-07 22:28:20 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g = oa.prototype;
|
|
|
|
g.start = function(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
null != this.a && null != this.b && (new t(this.a, this.b)).contains(a) ? (this.p = a, pa(this), qa(this, a)) : (this.a = a, this.b = null, this.K = !1, this.move(a));
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function pa(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
var b = a.state.j.filter(function(a) {
|
|
|
|
return null != B(a.n) && "\u2009" != B(a.n);
|
2014-05-07 20:58:40 +00:00
|
|
|
}), c = ca(new t(a.a, a.b));
|
2014-04-27 12:57:15 +00:00
|
|
|
a.v = b.map(function(a) {
|
2014-05-07 20:58:40 +00:00
|
|
|
return new fa(r(a.position, c), B(a.n));
|
2014-04-27 11:29:34 +00:00
|
|
|
});
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g.move = function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
if (null != this.p) {
|
2014-04-27 12:20:23 +00:00
|
|
|
qa(this, a);
|
2014-04-27 11:29:34 +00:00
|
|
|
} else {
|
|
|
|
if (!0 != this.K) {
|
|
|
|
this.b = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
M(this.state);
|
2014-04-27 13:30:54 +00:00
|
|
|
a = new t(this.a, a);
|
2014-04-27 12:57:15 +00:00
|
|
|
for (var b = a.w;b <= a.I;b++) {
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var c = a.A;c <= a.J;c++) {
|
|
|
|
var d = new p(b, c), e = B(F(this.state, d));
|
|
|
|
K(this.state, d, null == e ? "\u2009" : e);
|
2014-04-27 11:29:34 +00:00
|
|
|
}
|
2014-04-07 22:28:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function qa(a, b) {
|
2014-04-27 11:29:34 +00:00
|
|
|
a.F = b;
|
2014-04-27 12:57:15 +00:00
|
|
|
M(a.state);
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = new P(a.state);
|
|
|
|
c.start(a.a);
|
|
|
|
c.move(a.b);
|
|
|
|
c = r(a.F, a.p).add(ca(new t(a.a, a.b)));
|
|
|
|
ra(a, c);
|
2014-04-27 11:29:34 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function ra(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var c in a.v) {
|
|
|
|
K(a.state, a.v[c].position.add(b), a.v[c].value);
|
2014-04-07 22:28:20 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
g.end = function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
null != this.p && (N(this.state), this.b = this.a = null);
|
|
|
|
this.F = this.p = null;
|
2014-04-27 11:29:34 +00:00
|
|
|
this.K = !0;
|
2014-04-07 22:28:20 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.l = function(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
return null != this.a && null != this.b && (new t(this.a, this.b)).contains(a) ? "pointer" : "default";
|
2014-04-07 22:28:20 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
g.g = function(a) {
|
2014-04-27 12:20:23 +00:00
|
|
|
if (null != this.a && null != this.b && ("<copy>" != a && "<cut>" != a || pa(this), "<cut>" == a)) {
|
2014-04-27 12:57:15 +00:00
|
|
|
var b = new P(this.state);
|
2014-04-27 11:29:34 +00:00
|
|
|
b.start(this.a);
|
|
|
|
b.move(this.b);
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-04-27 11:29:34 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
"<paste>" == a && (ra(this, this.a), N(this.state));
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
function Q() {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.cells = Array(2E3);
|
2014-04-27 13:30:54 +00:00
|
|
|
this.j = [];
|
2014-04-27 12:57:15 +00:00
|
|
|
this.f = !0;
|
2014-04-27 13:30:54 +00:00
|
|
|
this.R = [];
|
|
|
|
this.O = [];
|
2014-02-24 23:51:05 +00:00
|
|
|
for (var a = 0;a < this.cells.length;a++) {
|
|
|
|
this.cells[a] = Array(600);
|
|
|
|
for (var b = 0;b < this.cells[a].length;b++) {
|
2014-04-27 13:30:54 +00:00
|
|
|
this.cells[a][b] = new da;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
Q.prototype.clear = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
for (var a = 0;a < this.cells.length;a++) {
|
|
|
|
for (var b = 0;b < this.cells[a].length;b++) {
|
2014-04-27 13:30:54 +00:00
|
|
|
null != B(this.cells[a][b]) && K(this, new p(a, b), "\u2009");
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
function F(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
return a.cells[b.x][b.y];
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
function K(a, b, c) {
|
|
|
|
var d = F(a, b);
|
|
|
|
a.j.push(new ga(b, d));
|
|
|
|
d.h = c;
|
2014-04-27 12:57:15 +00:00
|
|
|
a.f = !0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
function J(a, b, c) {
|
|
|
|
B(F(a, b)) != c && K(a, b, c);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
function M(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
for (var b in a.j) {
|
|
|
|
a.j[b].n.h = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
a.j.length = 0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function G(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = F(a, b), c = null != c.h ? c.h : c.value, d = -1 != h.indexOf(c), e = -1 != m.indexOf(c);
|
2014-04-27 13:30:54 +00:00
|
|
|
if (!d && !e) {
|
2014-02-24 23:51:05 +00:00
|
|
|
return c;
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
var f = a.getContext(b);
|
|
|
|
if (f.left && f.right && !f.k && !f.i) {
|
2014-04-27 12:27:00 +00:00
|
|
|
return "-";
|
2014-04-27 12:20:23 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (!f.left && !f.right && f.k && f.i) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "|";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (4 == D(f)) {
|
2014-04-27 12:27:00 +00:00
|
|
|
return "-";
|
2014-04-27 12:20:23 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (e && 3 == D(f)) {
|
|
|
|
if (!f.left) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "<";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (!f.k) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "^";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (!f.i) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "v";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (!f.right) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return ">";
|
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if ((d || e) && 3 == D(f)) {
|
|
|
|
return f.M = C(F(a, b.add(v).add(x))), f.Q = C(F(a, b.add(w).add(x))), f.L = C(F(a, b.add(v).add(y))), f.P = C(F(a, b.add(w).add(y))), !f.right && f.M && f.L || !f.left && f.Q && f.P ? "|" : !f.i && f.M && f.Q || !f.k && f.P && f.L ? "-" : "+";
|
2014-04-27 13:30:54 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (e && 1 == D(f)) {
|
|
|
|
if (f.left) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return ">";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (f.k) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "v";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (f.i) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "^";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (f.right) {
|
2014-04-27 12:20:23 +00:00
|
|
|
return "<";
|
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
return c;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
Q.prototype.getContext = function(a) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var b = C(F(this, a.add(v))), c = C(F(this, a.add(w))), d = C(F(this, a.add(x)));
|
2014-04-27 13:30:54 +00:00
|
|
|
a = C(F(this, a.add(y)));
|
2014-05-07 20:58:40 +00:00
|
|
|
return new ea(b, c, d, a);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function N(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = [], d = a.j.map(function(a) {
|
2014-02-24 23:51:05 +00:00
|
|
|
return a.position.x.toString() + a.position.y.toString();
|
2014-04-27 13:30:54 +00:00
|
|
|
}), e = a.j.filter(function(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
return d.indexOf(d[b]) == b;
|
2014-02-24 23:51:05 +00:00
|
|
|
});
|
2014-04-27 13:30:54 +00:00
|
|
|
a.j.length = 0;
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var f in e) {
|
|
|
|
var l = e[f].position, k = e[f].n;
|
|
|
|
c.push(new fa(l, null != k.value ? k.value : " "));
|
2014-04-27 13:30:54 +00:00
|
|
|
var s = B(k);
|
|
|
|
if ("\u2009" == s || " " == s) {
|
|
|
|
s = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
C(k) && (s = G(a, l));
|
|
|
|
k.h = null;
|
|
|
|
k.value = s;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
e = b ? a.O : a.R;
|
2014-05-07 20:58:40 +00:00
|
|
|
0 < c.length && (50 < e.length && e.shift(), e.push(c));
|
2014-04-27 12:57:15 +00:00
|
|
|
a.f = !0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function sa(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
if (0 != a.R.length) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var b = a.R.pop(), c;
|
|
|
|
for (c in b) {
|
|
|
|
var d = b[c];
|
|
|
|
K(a, d.position, d.value);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
N(a, !0);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function ta(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
if (0 != a.O.length) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var b = a.O.pop(), c;
|
|
|
|
for (c in b) {
|
|
|
|
var d = b[c];
|
|
|
|
K(a, d.position, d.value);
|
2014-03-23 11:52:12 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
N(a);
|
2014-03-23 11:52:12 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
function R(a) {
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var b = new p(Number.MAX_VALUE, Number.MAX_VALUE), c = new p(-1, -1), d = 0;d < a.cells.length;d++) {
|
|
|
|
for (var e = 0;e < a.cells[d].length;e++) {
|
|
|
|
null != B(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));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
if (0 > c.x) {
|
2014-02-24 23:51:05 +00:00
|
|
|
return "";
|
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var f = "", e = b.y;e <= c.y;e++) {
|
|
|
|
for (var l = "", d = b.x;d <= c.x;d++) {
|
|
|
|
var k = G(a, new p(d, e)), l = l + (null == k ? " " : k)
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
f += l.replace("\\s+$/g", "") + "\n";
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
return f;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
function ua(a, b, c) {
|
2014-03-23 19:16:21 +00:00
|
|
|
b = b.split("\n");
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var d = new p(0, Math.round(b.length / 2)), e = 0;e < b.length;e++) {
|
|
|
|
d.x = Math.max(d.x, Math.round(b[e].length / 2));
|
2014-03-23 19:55:46 +00:00
|
|
|
}
|
2014-03-23 22:12:53 +00:00
|
|
|
for (e = 0;e < b.length;e++) {
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var f = b[e], l = 0;l < f.length;l++) {
|
|
|
|
var k = f.charAt(l);
|
2014-04-27 12:57:15 +00:00
|
|
|
-1 != h.indexOf(k) && (k = "+");
|
2014-04-27 12:20:23 +00:00
|
|
|
-1 != m.indexOf(k) && (k = "^");
|
2014-05-07 20:58:40 +00:00
|
|
|
K(a, r((new p(l, e)).add(c), d), k);
|
2014-03-23 19:16:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
;function S(a, b) {
|
2014-02-24 23:51:05 +00:00
|
|
|
this.view = a;
|
|
|
|
this.state = b;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.d = new L(b);
|
2014-02-24 23:51:05 +00:00
|
|
|
this.mode = 0;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.r();
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
S.prototype.u = function(a) {
|
|
|
|
var b = E(this.view, a);
|
2014-04-27 12:57:15 +00:00
|
|
|
null == this.s && (this.s = b);
|
2014-04-27 13:30:54 +00:00
|
|
|
q(b, this.s) || (this.view.canvas.style.cursor = this.d.l(b));
|
2014-04-27 12:57:15 +00:00
|
|
|
2 != this.mode || q(b, this.s) || this.d.move(b);
|
2014-02-24 23:51:05 +00:00
|
|
|
if (1 == this.mode) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = this.view;
|
2014-04-27 12:20:23 +00:00
|
|
|
a = this.H.add(r(this.G, a).scale(1 / this.view.zoom));
|
2014-05-07 20:58:40 +00:00
|
|
|
c.offset = a;
|
|
|
|
c.f = !0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
this.s = b;
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
function T(a) {
|
2014-04-07 22:28:20 +00:00
|
|
|
2 == a.mode && a.d.end();
|
2014-02-24 23:51:05 +00:00
|
|
|
a.mode = 0;
|
2014-04-07 22:28:20 +00:00
|
|
|
a.G = null;
|
2014-04-27 11:29:34 +00:00
|
|
|
a.H = null;
|
2014-04-27 12:57:15 +00:00
|
|
|
a.s = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 13:30:54 +00:00
|
|
|
S.prototype.r = function() {
|
2014-02-24 23:51:05 +00:00
|
|
|
var a = this;
|
|
|
|
$(window).resize(function() {
|
2014-04-27 13:30:54 +00:00
|
|
|
ia(a.view);
|
2014-02-24 23:51:05 +00:00
|
|
|
});
|
2014-03-22 20:12:04 +00:00
|
|
|
$("#draw-tools > button.tool").click(function(a) {
|
2014-03-23 12:09:25 +00:00
|
|
|
$("#text-tool-widget").hide(0);
|
2014-02-24 23:51:05 +00:00
|
|
|
a = a.target.id;
|
2014-03-22 20:12:04 +00:00
|
|
|
$("#draw-tools > button.tool").removeClass("active");
|
2014-02-24 23:51:05 +00:00
|
|
|
$("#" + a).toggleClass("active");
|
2014-03-22 20:12:04 +00:00
|
|
|
$(".dialog").removeClass("visible");
|
2014-04-27 12:57:15 +00:00
|
|
|
"box-button" == a && (this.d = new L(this.state));
|
|
|
|
"line-button" == a && (this.d = new O(this.state, !1));
|
|
|
|
"arrow-button" == a && (this.d = new O(this.state, !0));
|
2014-04-27 12:20:23 +00:00
|
|
|
"freeform-button" == a && (this.d = new ka(this.state, "X"));
|
2014-04-27 12:57:15 +00:00
|
|
|
"erase-button" == a && (this.d = new P(this.state));
|
2014-04-27 12:20:23 +00:00
|
|
|
"move-button" == a && (this.d = new ma(this.state));
|
|
|
|
"text-button" == a && (this.d = new la(this.state));
|
|
|
|
"select-button" == a && (this.d = new oa(this.state));
|
|
|
|
N(this.state);
|
2014-03-23 11:52:12 +00:00
|
|
|
this.view.canvas.focus();
|
2014-03-22 20:12:04 +00:00
|
|
|
}.bind(this));
|
|
|
|
$("#file-tools > button.tool").click(function(a) {
|
|
|
|
a = a.target.id;
|
|
|
|
$(".dialog").removeClass("visible");
|
|
|
|
$("#" + a + "-dialog").toggleClass("visible");
|
2014-03-25 21:46:31 +00:00
|
|
|
"import-button" == a && ($("#import-area").val(""), $("#import-area").focus());
|
2014-04-27 13:30:54 +00:00
|
|
|
"export-button" == a && ($("#export-area").val(R(this.state)), $("#export-area").select());
|
2014-02-24 23:51:05 +00:00
|
|
|
"clear-button" == a && this.state.clear();
|
2014-04-27 12:20:23 +00:00
|
|
|
"undo-button" == a && sa(this.state);
|
|
|
|
"redo-button" == a && ta(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
$("button.close-dialog-button").click(function() {
|
|
|
|
$(".dialog").removeClass("visible");
|
|
|
|
}.bind(this));
|
|
|
|
$("#import-submit-button").click(function() {
|
|
|
|
this.state.clear();
|
2014-04-27 13:30:54 +00:00
|
|
|
ua(this.state, $("#import-area").val(), E(this.view, new p(this.view.canvas.width / 2, this.view.canvas.height / 2)));
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
$("#import-area").val("");
|
2014-03-26 19:53:06 +00:00
|
|
|
$(".dialog").removeClass("visible");
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
2014-03-10 22:54:02 +00:00
|
|
|
$("#use-lines-button").click(function() {
|
|
|
|
$(".dialog").removeClass("visible");
|
2014-03-23 11:52:12 +00:00
|
|
|
var a = this.view;
|
2014-04-27 12:57:15 +00:00
|
|
|
a.B = !0;
|
|
|
|
a.f = !0;
|
2014-03-10 22:54:02 +00:00
|
|
|
}.bind(this));
|
|
|
|
$("#use-ascii-button").click(function() {
|
|
|
|
$(".dialog").removeClass("visible");
|
2014-03-23 11:52:12 +00:00
|
|
|
var a = this.view;
|
2014-04-27 12:57:15 +00:00
|
|
|
a.B = !1;
|
|
|
|
a.f = !0;
|
2014-03-10 22:54:02 +00:00
|
|
|
}.bind(this));
|
2014-02-24 23:51:05 +00:00
|
|
|
$(window).keypress(function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
a.ctrlKey || a.metaKey || 13 == a.keyCode || this.d.g(String.fromCharCode(a.keyCode));
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
$(window).keydown(function(a) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
if (a.ctrlKey || a.metaKey) {
|
2014-05-07 20:58:40 +00:00
|
|
|
67 == a.keyCode && (c = "<copy>"), 86 == a.keyCode && (c = "<paste>"), 90 == a.keyCode && sa(this.state), 89 == a.keyCode && ta(this.state), 88 == a.keyCode && (c = "<cut>");
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-05-07 20:58:40 +00:00
|
|
|
8 == a.keyCode && (c = "<backspace>");
|
|
|
|
13 == a.keyCode && (c = "<enter>");
|
|
|
|
38 == a.keyCode && (c = "<up>");
|
|
|
|
40 == a.keyCode && (c = "<down>");
|
|
|
|
37 == a.keyCode && (c = "<left>");
|
|
|
|
39 == a.keyCode && (c = "<right>");
|
|
|
|
null != c && this.d.g(c);
|
2014-03-23 11:52:12 +00:00
|
|
|
}.bind(this));
|
2014-03-23 12:25:03 +00:00
|
|
|
$("#text-tool-input, #freeform-tool-input").keyup(function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.d.g("");
|
2014-03-23 11:52:12 +00:00
|
|
|
}.bind(this));
|
2014-03-23 12:25:03 +00:00
|
|
|
$("#text-tool-input, #freeform-tool-input").change(function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.d.g("");
|
2014-03-23 11:52:12 +00:00
|
|
|
}.bind(this));
|
|
|
|
$("#text-tool-close").click(function() {
|
|
|
|
$("#text-tool-widget").hide();
|
2014-04-27 12:20:23 +00:00
|
|
|
N(this.state);
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function va(a, b) {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.t = !1;
|
2014-03-02 22:20:20 +00:00
|
|
|
this.state = a;
|
2014-03-23 19:16:21 +00:00
|
|
|
this.view = b;
|
2014-03-02 22:20:20 +00:00
|
|
|
this.file = null;
|
2014-04-27 12:20:23 +00:00
|
|
|
wa(this);
|
2014-03-23 17:06:40 +00:00
|
|
|
$("#drive-button").click(function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.t ? xa(this) : (V(this, !1), ya(this));
|
2014-03-23 17:06:40 +00:00
|
|
|
}.bind(this));
|
2014-03-23 19:16:21 +00:00
|
|
|
$("#drive-filename").click(function() {
|
|
|
|
var a = "" + $("#drive-filename").text(), a = prompt("Enter new filename:", a);
|
|
|
|
this.file.title = a;
|
|
|
|
this.save();
|
2014-04-27 12:20:23 +00:00
|
|
|
za(this);
|
2014-03-23 22:12:53 +00:00
|
|
|
}.bind(this));
|
2014-04-27 12:20:23 +00:00
|
|
|
Aa(this);
|
2014-03-23 22:12:53 +00:00
|
|
|
$(window).bind("hashchange", function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
Ba(this);
|
2014-03-23 22:12:53 +00:00
|
|
|
}.bind(this));
|
|
|
|
$("#drive-new-file-button").click(function() {
|
|
|
|
this.file = null;
|
|
|
|
this.state.clear();
|
|
|
|
window.location.hash = "";
|
|
|
|
this.save();
|
|
|
|
$("#drive-dialog").removeClass("visible");
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(this));
|
2014-03-02 22:20:20 +00:00
|
|
|
}
|
2014-03-23 22:47:15 +00:00
|
|
|
function V(a, b) {
|
2014-03-23 19:16:21 +00:00
|
|
|
window.gapi.auth.authorize({client_id:"125643747010-9s9n1ne2fnnuh5v967licfkt83r4vba5.apps.googleusercontent.com", scope:"https://www.googleapis.com/auth/drive", immediate:b}, function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
!a || a.error || this.t || (this.t = !0, $("#drive-button").addClass("active"), window.setTimeout(function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
Ba(this);
|
2014-03-25 22:19:41 +00:00
|
|
|
}.bind(this), 500));
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(a));
|
2014-03-02 22:20:20 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function wa(a) {
|
2014-03-23 22:47:15 +00:00
|
|
|
window.gapi && window.gapi.auth && window.gapi.auth.authorize ? V(a, !0) : window.setTimeout(function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
wa(this);
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(a), 500);
|
2014-03-23 17:06:40 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function ya(a) {
|
2014-03-23 17:06:40 +00:00
|
|
|
window.setTimeout(function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.t ? xa(this) : (V(this, !0), ya(this));
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(a), 1E3);
|
2014-03-23 17:06:40 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Ca(a, b) {
|
2014-03-03 23:10:15 +00:00
|
|
|
a.file = b;
|
|
|
|
$("#drive-filename").text(b.title);
|
2014-03-23 19:16:21 +00:00
|
|
|
window.location.hash = b.id;
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function xa(a) {
|
2014-03-23 19:16:21 +00:00
|
|
|
$("#drive-dialog").addClass("visible");
|
2014-04-27 13:30:54 +00:00
|
|
|
var b = R(a.state);
|
2014-04-27 12:57:15 +00:00
|
|
|
5 < b.length && b != a.D && a.save();
|
2014-04-27 12:20:23 +00:00
|
|
|
za(a);
|
2014-03-23 19:16:21 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function za(a) {
|
2014-03-23 22:47:15 +00:00
|
|
|
W(window.gapi.client.request({path:"/drive/v2/files", params:{q:"mimeType = 'text/plain' and trashed = false"}, method:"GET"}), function(a) {
|
2014-03-23 22:12:53 +00:00
|
|
|
$("#drive-file-list").children().remove();
|
|
|
|
a = a.items;
|
2014-05-07 20:58:40 +00:00
|
|
|
for (var c in a) {
|
|
|
|
var d = document.createElement("li"), e = document.createElement("a");
|
|
|
|
d.appendChild(e);
|
|
|
|
e.href = "#" + a[c].id;
|
2014-03-25 23:46:37 +00:00
|
|
|
$(e).click(function() {
|
|
|
|
$("#drive-dialog").removeClass("visible");
|
|
|
|
});
|
2014-05-07 20:58:40 +00:00
|
|
|
e.innerHTML = a[c].title;
|
|
|
|
$("#drive-file-list").append(d);
|
2014-03-23 22:12:53 +00:00
|
|
|
}
|
|
|
|
}.bind(a));
|
|
|
|
}
|
2014-03-23 22:47:15 +00:00
|
|
|
function W(a, b) {
|
|
|
|
try {
|
|
|
|
a.execute(function(a) {
|
|
|
|
a.error || b(a);
|
|
|
|
});
|
2014-05-07 20:58:40 +00:00
|
|
|
} catch (c) {
|
2014-03-23 22:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Aa(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
R(a.state) != a.D && a.file && a.file.editable && a.save();
|
2014-03-23 19:16:21 +00:00
|
|
|
window.setTimeout(function() {
|
2014-04-27 12:20:23 +00:00
|
|
|
Aa(this);
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(a), 5E3);
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
va.prototype.save = function() {
|
2014-04-27 13:30:54 +00:00
|
|
|
var a = R(this.state);
|
2014-03-23 19:16:21 +00:00
|
|
|
$("#drive-save-state").text("Saving...");
|
2014-04-27 12:20:23 +00:00
|
|
|
W(Da(this, a), function(b) {
|
|
|
|
Ca(this, b);
|
2014-03-23 19:16:21 +00:00
|
|
|
$("#drive-save-state").text("Saved");
|
2014-04-27 12:57:15 +00:00
|
|
|
this.D = a;
|
2014-03-02 22:20:20 +00:00
|
|
|
}.bind(this));
|
|
|
|
};
|
2014-04-27 12:20:23 +00:00
|
|
|
function Ba(a) {
|
2014-03-23 22:47:15 +00:00
|
|
|
1 < window.location.hash.length && ($("#drive-save-state").text("Loading..."), W(window.gapi.client.request({path:"/drive/v2/files/" + window.location.hash.substr(1, window.location.hash.length - 1), method:"GET"}), function(a) {
|
2014-04-27 12:20:23 +00:00
|
|
|
Ca(this, a);
|
|
|
|
Ea(this);
|
2014-03-23 19:55:46 +00:00
|
|
|
}.bind(a)));
|
2014-03-02 22:20:20 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Ea(a) {
|
|
|
|
Fa(a.file.downloadUrl, function(a) {
|
2014-03-23 19:55:46 +00:00
|
|
|
$("#drive-save-state").text("Loaded");
|
2014-03-23 19:16:21 +00:00
|
|
|
this.state.clear();
|
2014-04-27 13:30:54 +00:00
|
|
|
ua(this.state, a, E(this.view, new p(this.view.canvas.width / 2, this.view.canvas.height / 2)));
|
2014-04-27 14:47:52 +00:00
|
|
|
N(this.state);
|
2014-04-27 13:30:54 +00:00
|
|
|
this.D = R(this.state);
|
2014-03-23 19:16:21 +00:00
|
|
|
}.bind(a));
|
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Da(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = "\r\n---------314159265358979323846\r\nContent-Type: application/json\r\n\r\n" + JSON.stringify({title:null == a.file ? "Untitled ASCII Diagram" : a.file.title, mimeType:"text/plain"}) + "\r\n---------314159265358979323846\r\nContent-Type: text/plain\r\n\r\n" + b + "\r\n---------314159265358979323846--";
|
|
|
|
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});
|
2014-03-23 19:16:21 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Fa(a, b) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = window.gapi.auth.getToken().access_token, d = new XMLHttpRequest;
|
|
|
|
d.open("GET", a);
|
|
|
|
d.setRequestHeader("Authorization", "Bearer " + c);
|
|
|
|
d.onload = function() {
|
|
|
|
b(d.responseText);
|
2014-03-23 19:16:21 +00:00
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
d.onerror = function() {
|
2014-03-23 19:16:21 +00:00
|
|
|
b(null);
|
|
|
|
};
|
2014-05-07 20:58:40 +00:00
|
|
|
d.send();
|
2014-03-23 19:16:21 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
;function Ga(a) {
|
2014-04-27 11:29:34 +00:00
|
|
|
this.c = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.r();
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
Ga.prototype.r = function() {
|
2014-04-27 11:29:34 +00:00
|
|
|
var a = this.c.view.canvas;
|
2014-02-24 23:51:05 +00:00
|
|
|
$(a).bind("mousewheel", function(a) {
|
2014-04-27 11:29:34 +00:00
|
|
|
a = this.c.view.zoom * (0 < a.originalEvent.wheelDelta ? 1.1 : 0.9);
|
2014-02-24 23:51:05 +00:00
|
|
|
a = Math.max(Math.min(a, 5), 0.2);
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = this.c.view;
|
|
|
|
c.zoom = a;
|
|
|
|
c.f = !0;
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
$(a).mousedown(function(a) {
|
|
|
|
if (a.ctrlKey || a.metaKey) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = this.c;
|
2014-04-27 12:20:23 +00:00
|
|
|
a = new p(a.clientX, a.clientY);
|
2014-05-07 20:58:40 +00:00
|
|
|
c.mode = 1;
|
|
|
|
c.G = a;
|
|
|
|
c.H = c.view.offset;
|
2014-02-24 23:51:05 +00:00
|
|
|
} else {
|
2014-05-07 20:58:40 +00:00
|
|
|
c = this.c, a = new p(a.clientX, a.clientY), c.mode = 2, c.d.start(E(c.view, a));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}.bind(this));
|
|
|
|
$(a).mouseup(function() {
|
2014-04-27 13:30:54 +00:00
|
|
|
T(this.c);
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
$(a).mouseleave(function() {
|
2014-04-27 13:30:54 +00:00
|
|
|
T(this.c);
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
$(a).mousemove(function(a) {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.c.u(new p(a.clientX, a.clientY));
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
};
|
2014-03-23 19:16:21 +00:00
|
|
|
function X(a) {
|
2014-04-27 11:29:34 +00:00
|
|
|
this.c = a;
|
2014-04-27 12:57:15 +00:00
|
|
|
this.C = this.m = !1;
|
|
|
|
this.r();
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:20:23 +00:00
|
|
|
function Ha(a, b) {
|
2014-04-27 13:30:54 +00:00
|
|
|
a.N = b;
|
|
|
|
a.Y = $.now();
|
2014-04-27 12:20:23 +00:00
|
|
|
a.m = !1;
|
2014-02-24 23:51:05 +00:00
|
|
|
window.setTimeout(function() {
|
2014-04-27 13:30:54 +00:00
|
|
|
if (!this.m && !this.C && null != this.N) {
|
2014-04-27 11:29:34 +00:00
|
|
|
var a = this.c;
|
2014-02-24 23:51:05 +00:00
|
|
|
a.mode = 2;
|
2014-04-27 13:30:54 +00:00
|
|
|
a.d.start(E(a.view, b));
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-03-26 19:48:41 +00:00
|
|
|
}.bind(a), 150);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
X.prototype.u = function(a) {
|
2014-04-27 13:30:54 +00:00
|
|
|
if (!this.m && 150 > $.now() - this.Y && 6 < r(a, this.N).length()) {
|
2014-04-27 12:20:23 +00:00
|
|
|
this.m = !0;
|
2014-04-27 11:29:34 +00:00
|
|
|
var b = this.c;
|
2014-02-24 23:51:05 +00:00
|
|
|
b.mode = 1;
|
2014-04-27 11:29:34 +00:00
|
|
|
b.G = a;
|
|
|
|
b.H = b.view.offset;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
2014-04-27 12:57:15 +00:00
|
|
|
this.c.u(a);
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-03-23 19:16:21 +00:00
|
|
|
X.prototype.reset = function() {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.C = this.m = !1;
|
2014-04-27 13:30:54 +00:00
|
|
|
this.N = null;
|
2014-02-24 23:51:05 +00:00
|
|
|
};
|
2014-04-27 12:57:15 +00:00
|
|
|
X.prototype.r = function() {
|
2014-04-27 11:29:34 +00:00
|
|
|
var a = this.c.view.canvas;
|
2014-02-24 23:51:05 +00:00
|
|
|
$(a).bind("touchstart", function(a) {
|
|
|
|
a.preventDefault();
|
|
|
|
if (1 == a.originalEvent.touches.length) {
|
2014-04-27 12:20:23 +00:00
|
|
|
Ha(this, new p(a.originalEvent.touches[0].pageX, a.originalEvent.touches[0].pageY));
|
2014-02-24 23:51:05 +00:00
|
|
|
} else {
|
|
|
|
if (1 < a.originalEvent.touches.length) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = new p(a.originalEvent.touches[0].pageX, a.originalEvent.touches[0].pageY);
|
2014-04-27 12:20:23 +00:00
|
|
|
a = new p(a.originalEvent.touches[1].pageX, a.originalEvent.touches[1].pageY);
|
2014-04-27 13:30:54 +00:00
|
|
|
T(this.c);
|
2014-04-27 12:57:15 +00:00
|
|
|
this.C = !0;
|
2014-04-27 12:20:23 +00:00
|
|
|
this.m = !1;
|
2014-05-07 20:58:40 +00:00
|
|
|
this.Z = r(c, a).length();
|
2014-04-27 13:30:54 +00:00
|
|
|
this.X = this.c.view.zoom;
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}.bind(this));
|
|
|
|
$(a).bind("touchmove", function(a) {
|
|
|
|
a.preventDefault();
|
|
|
|
if (1 == a.originalEvent.touches.length) {
|
2014-04-27 12:57:15 +00:00
|
|
|
this.u(new p(a.originalEvent.touches[0].pageX, a.originalEvent.touches[0].pageY));
|
2014-02-24 23:51:05 +00:00
|
|
|
} else {
|
|
|
|
if (1 < a.originalEvent.touches.length) {
|
2014-05-07 20:58:40 +00:00
|
|
|
var c = new p(a.originalEvent.touches[0].pageX, a.originalEvent.touches[0].pageY);
|
2014-04-27 12:20:23 +00:00
|
|
|
a = new p(a.originalEvent.touches[1].pageX, a.originalEvent.touches[1].pageY);
|
2014-05-07 20:58:40 +00:00
|
|
|
this.C && (c = this.X * r(c, a).length() / this.Z, c = Math.max(Math.min(c, 5), 0.5), a = this.c.view, a.zoom = c, a.f = !0);
|
2014-02-24 23:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}.bind(this));
|
|
|
|
$(a).bind("touchend", function(a) {
|
|
|
|
a.preventDefault();
|
|
|
|
this.reset();
|
2014-04-27 13:30:54 +00:00
|
|
|
T(this.c);
|
2014-02-24 23:51:05 +00:00
|
|
|
}.bind(this));
|
|
|
|
};
|
2014-04-27 13:30:54 +00:00
|
|
|
var Y = new Q, Z = new ha(Y), Ia = new S(Z, Y);
|
2014-04-27 12:20:23 +00:00
|
|
|
new X(Ia);
|
|
|
|
new Ga(Ia);
|
|
|
|
new va(Y, Z);
|
2014-03-23 19:16:21 +00:00
|
|
|
Z.animate();
|
2014-02-24 23:51:05 +00:00
|
|
|
|