UNPKG

igniteui-react-core

Version:
1,087 lines (1,086 loc) 34.2 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __extends } from "tslib"; import { Base, Point_$type, typeCast, markType, PointUtil } from "./type"; import { IRenderer_$type } from "./IRenderer"; import { Brush } from "./Brush"; import { List$1 } from "./List$1"; import { ArcSegment } from "./ArcSegment"; import { Size } from "./Size"; import { CoreGeometryUtil } from "./CoreGeometryUtil"; import { TransformGroup } from "./TransformGroup"; import { TranslateTransform } from "./TranslateTransform"; import { RotateTransform } from "./RotateTransform"; import { ScaleTransform } from "./ScaleTransform"; import { TextFontMetrics } from "./TextFontMetrics"; import { isNaN_ } from "./number"; /** * @hidden */ var CanvasViewRenderer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CanvasViewRenderer, _super); function CanvasViewRenderer() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.j = null; _this.h = 0; _this.f = 0; _this.i = 0; _this.g = 0; _this.b = false; _this.c = false; _this.aa = null; _this.m = "left"; _this.a = null; _this.d = 11; _this.e = 1; return _this; } CanvasViewRenderer.prototype.h$e = function () { return this.j; }; Object.defineProperty(CanvasViewRenderer.prototype, "h$d", { get: function () { return this.j; }, set: function (a) { this.j = a; }, enumerable: false, configurable: true }); CanvasViewRenderer.prototype.l = function (a, b, c, d, e, f, g) { return CanvasViewRenderer.k(this.j, a, b, c, d, e, f, g); }; CanvasViewRenderer.k = function (a, b, c, d, e, f, g, h) { var i; if (b.useCustomDirection) { var j = void 0, k = void 0, l = void 0, m = void 0, n = void 0; n = e - c; j = c + b.startX * n; l = c + b.endX * n; n = f - d; k = d + b.startY * n; m = d + b.endY * n; if (h) { var o = g / 2; j -= o; l += o; k -= o; m += o; } i = a.createLinearGradient(j, k, l, m); } else { if (h) { var p = g / 2; c -= p; e += p; d -= p; f += p; } i = a.createLinearGradient(c, d, c, f); } for (var q = 0; q < b.gradientStops.length; q++) { var r = b.gradientStops[q]; i.addColorStop(r.offset, r._fill); } return i; }; CanvasViewRenderer.prototype.h$t = function (a) { if (a._visibility != 0) { return; } var b = a.n; var c = a.o; var d = a.width; var e = a.height; var f = a.ap; var g = a.aq; this.j.beginPath(); this.j.globalAlpha = (a._opacity * this.e); if (a.ai != null) { var h = new Array(a.ai.count); for (var i = 0; i < a.ai.count; i++) { h[i] = a.ai._inner[i]; } this.j.setLineDash(h); } else { this.j.setLineDash(new Array(0)); } if (f > 0 || g > 0) { if (f > d / 2) { f = (d / 2); } if (g > e / 2) { g = (e / 2); } var j = Math.min(f, g); this.j.beginPath(); this.j.moveTo(b + j, c); this.j.lineTo(b + d - j, c); this.j.arc(b + d - j, c + j, j, (3 / 2 * Math.PI), 0, false); this.j.lineTo(b + d, c + e - j); this.j.arc(b + d - j, c + e - j, j, 0, (Math.PI / 2), false); this.j.lineTo(b + j, c + e); this.j.arc(b + j, c + e - j, j, (Math.PI / 2), Math.PI, false); this.j.lineTo(b, c + j); this.j.arc(b + j, c + j, j, Math.PI, (3 / 2 * Math.PI), false); this.j.closePath(); } else { this.j.rect(b, c, d, e); } var k = a._fill; var l = a._stroke; if (k != null) { if (k.isGradient && c == c && b == b) { this.j.fillStyle = this.l(k, b, c, b + d, c + e, a.ad, false); } else { this.j.fillStyle = k._fill; } this.j.fill(); } if (l != null) { if (l.isGradient && c == c && b == b) { this.j.strokeStyle = this.l(l, b, c, b + d, c + e, a.ad, true); } else { this.j.strokeStyle = l._fill; } this.j.lineWidth = a.ad; this.j.stroke(); } this.j.globalAlpha = 1; if (a.ai != null) { this.j.setLineDash(new Array(0)); } }; CanvasViewRenderer.prototype.h$q = function (a) { if (a._visibility != 0) { return; } this.j.beginPath(); if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = (a._opacity * this.e); } var b = a._fill; var c = a._stroke; this.b = (b != null && b.isGradient) || (c != null && c.isGradient); if (this.b) { this.f = -1.7976931348623157E+308; this.g = -1.7976931348623157E+308; this.h = 1.7976931348623157E+308; this.i = 1.7976931348623157E+308; this.c = false; } switch (a.am) { case 0: this.j.lineJoin = "miter"; break; case 1: this.j.lineJoin = "bevel"; break; case 2: this.j.lineJoin = "round"; break; } switch (a.al) { case 0: this.j.lineCap = "butt"; break; case 3: case 2: this.j.lineCap = "round"; break; case 1: this.j.lineCap = "square"; break; } if (a.ai != null) { var d = new Array(a.ai.count); for (var e = 0; e < a.ai.count; e++) { d[e] = a.ai._inner[e]; } this.j.setLineDash(d); } else { this.j.setLineDash(new Array(0)); } this.h$o(a.an); if (b != null) { if (b.isGradient && this.c) { this.j.fillStyle = this.l(b, this.h, this.i, this.f, this.g, a.ad, false); } else { this.j.fillStyle = a._fill._fill; } this.j.fill(); } if (c != null) { if (c.isGradient && this.c) { this.j.strokeStyle = this.l(c, this.h, this.i, this.f, this.g, a.ad, true); } else { this.j.strokeStyle = a._stroke._fill; } this.j.lineWidth = a.ad; if (a.ad > 0) { this.j.stroke(); } } if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = 1; } if (a.ai != null) { this.j.setLineDash(new Array(0)); } }; CanvasViewRenderer.prototype.h$o = function (a) { if (a == null) { return; } var b = a.b; switch (b) { case 0: for (var c = 0; c < a.d.count; c++) { this.h$o(a.d._inner[c]); } break; case 4: this.t(a); break; case 1: this.r(a); break; case 2: this.w(a); break; case 3: this.p(a); break; } }; CanvasViewRenderer.prototype.p = function (a) { this.j.moveTo(a.e.x, (a.e.y - a.d)); this.aa = { $type: Point_$type, x: a.e.x, y: a.e.y - a.d }; var b = ((function () { var $ret = new ArcSegment(); $ret.e = { $type: Point_$type, x: a.e.x, y: a.e.y + a.d }; $ret.b = false; $ret.f = new Size(1, a.c, a.d); return $ret; })()); var c = ((function () { var $ret = new ArcSegment(); $ret.e = { $type: Point_$type, x: a.e.x, y: a.e.y - a.d }; $ret.b = false; $ret.f = new Size(1, a.c, a.d); return $ret; })()); var d = this.b; this.b = false; this.n(b); this.n(c); this.b = d; if (!this.b) { return; } var e = a.e.x - a.c; var f = a.e.y + a.c; var g = a.e.x - a.d; var h = a.e.y + a.d; var i = this.f; var j = this.g; var k = this.h; var l = this.i; this.h = e < k ? e : k; this.i = g < l ? g : l; this.f = f > i ? f : i; this.g = h > j ? h : j; this.c = true; }; CanvasViewRenderer.prototype.t = function (a) { var b = a.c; var c = b.count; for (var d = 0; d < c; d++) { this.q(b._inner[d]); } }; CanvasViewRenderer.prototype.q = function (a) { var b = a == null ? null : a._startPoint; if (PointUtil.equals(b, null)) { return; } var c = b.x; var d = b.y; this.j.moveTo(c, d); if (this.b) { var e = this.f; var f = this.g; var g = this.h; var h = this.i; this.h = c < g ? c : g; this.i = d < h ? d : h; this.f = c > e ? c : e; this.g = d > f ? d : f; this.c = true; } this.aa = b; var i = a._segments; var j = i.count; for (var k = 0; k < j; k++) { this.x(i._inner[k]); } if (a._isClosed) { this.j.closePath(); } }; CanvasViewRenderer.prototype.x = function (a) { var b = a.a; switch (b) { case 0: this.s(a); break; case 3: this.v(a); break; case 4: this.n(a); break; case 1: this.o(a); break; case 2: this.u(a); break; } }; CanvasViewRenderer.prototype.z = function (a, b, c, d, e, f, g, h) { var i = 1 / 50; var j; var k; var l; var m; var n; var o; var p; var q = this.h; var r = this.i; var s = this.f; var t = this.g; for (var u = 0; u <= 1; u += i) { j = 1 - u; k = j * j; l = k * j; m = u * u; n = m * u; o = l * a + 3 * k * u * c + 3 * j * m * e + n * g; p = l * b + 3 * k * u * d + 3 * j * m * f + n * h; q = o < q ? o : q; r = p < r ? p : r; s = o > s ? o : s; t = p > t ? p : t; } this.h = q; this.i = r; this.f = s; this.g = t; this.c = true; }; CanvasViewRenderer.prototype.o = function (a) { this.j.bezierCurveTo(a.e.x, a.e.y, a.f.x, a.f.y, a.g.x, a.g.y); if (this.b) { this.z(this.aa.x, this.aa.y, a.e.x, a.e.y, a.f.x, a.f.y, a.g.x, a.g.y); } }; CanvasViewRenderer.prototype.u = function (a) { var b = 0; var c = a.b.count; var d = a.b; var e = this.aa; var f = this.aa; var g = this.aa; var h = this.b; while (b < c) { if (b + 1 < c && b + 2 < c) { e = d._inner[b]; f = d._inner[b + 1]; g = d._inner[b + 2]; this.j.bezierCurveTo(e.x, e.y, f.x, f.y, g.x, g.y); if (h) { this.z(this.aa.x, this.aa.y, e.x, e.y, f.x, f.y, g.x, g.y); this.aa = g; } } b = b + 3; } this.aa = g; }; CanvasViewRenderer.prototype.y = function (a, b, c, d, e) { var f = new List$1(Point_$type, 0); f.add(a); f.add({ $type: Point_$type, x: a.x + Math.cos(b) * d, y: a.y + Math.sin(b) * d }); f.add({ $type: Point_$type, x: a.x + Math.cos(c) * d, y: a.y + Math.sin(c) * d }); var g = Math.PI * 2; var h = Math.PI / 2; var i = Math.PI; var j = Math.PI * 3 / 2; while (b < 0) { b += g; } while (b > g) { b -= g; } while (c < 0) { c += g; } while (c > g) { c -= g; } if (e) { if ((0 > c && 0 < b) || (g > c && g < b) || (b < c)) { f.add({ $type: Point_$type, x: a.x + Math.cos(0) * d, y: a.y + Math.sin(0) * d }); } if (h > c && h < b) { f.add({ $type: Point_$type, x: a.x + Math.cos(h) * d, y: a.y + Math.sin(h) * d }); } if (i > c && i < b) { f.add({ $type: Point_$type, x: a.x + Math.cos(i) * d, y: a.y + Math.sin(i) * d }); } if (j > c && j < b) { f.add({ $type: Point_$type, x: a.x + Math.cos(j) * d, y: a.y + Math.sin(j) * d }); } } else { if ((0 > b && 0 < c) || (g > b && g < c) || (c < b)) { f.add({ $type: Point_$type, x: a.x + Math.cos(0) * d, y: a.y + Math.sin(0) * d }); } if (h > b && h < c) { f.add({ $type: Point_$type, x: a.x + Math.cos(h) * d, y: a.y + Math.sin(h) * d }); } if (i > b && i < c) { f.add({ $type: Point_$type, x: a.x + Math.cos(i) * d, y: a.y + Math.sin(i) * d }); } if (j > b && j < c) { f.add({ $type: Point_$type, x: a.x + Math.cos(j) * d, y: a.y + Math.sin(j) * d }); } } var k = 1.7976931348623157E+308; var l = 1.7976931348623157E+308; var m = -1.7976931348623157E+308; var n = -1.7976931348623157E+308; for (var o = 0; o < f.count; o++) { var p = f._inner[o]; k = Math.min(k, p.x); l = Math.min(l, p.y); m = Math.max(m, p.x); n = Math.max(n, p.y); } this.h = Math.min(this.h, k); this.i = Math.min(this.i, l); this.f = Math.max(this.f, m); this.g = Math.max(this.g, n); this.c = true; }; CanvasViewRenderer.prototype.n = function (a) { var b = this.aa; var c = a.e; if (a.f.width != a.f.height) { this.j.save(); this.j.scale(a.f.width / a.f.height, 1); b = { $type: Point_$type, x: b.x * (a.f.height / a.f.width), y: b.y }; c = { $type: Point_$type, x: c.x * (a.f.height / a.f.width), y: c.y }; } var d = a.d == 0; var e = CoreGeometryUtil.c(b, c, a.f.height, d, a.b); var f = Math.atan2(b.y - e.y, b.x - e.x); var g = Math.atan2(c.y - e.y, c.x - e.x); var h = (Math.abs(g - f) < Math.PI); if (a.b == h) { if (f < g) { f += 2 * Math.PI; } else { g += 2 * Math.PI; } } if (!isNaN_(e.x) && !isNaN_(e.y) && !isNaN_(a.f.height) && !isNaN_(f) && !isNaN_(g)) { this.j.arc(e.x, e.y, a.f.height, f, g, d); if (this.b) { this.y(e, f, g, a.f.height, d); } } this.aa = a.e; if (a.f.width != a.f.height) { this.j.restore(); } }; CanvasViewRenderer.prototype.s = function (a) { var b = a.c.x; var c = a.c.y; this.j.lineTo(b, c); this.aa = a.c; if (this.b) { var d = this.f; var e = this.g; var f = this.h; var g = this.i; this.h = b < f ? b : f; this.i = c < g ? c : g; this.f = b > d ? b : d; this.g = c > e ? c : e; this.c = true; } }; CanvasViewRenderer.prototype.v = function (a) { var b = a._points; var c = b.count; if (this.b) { var d = this.h; var e = this.i; var f = this.f; var g = this.g; var h = void 0; var i = void 0; for (var j = 0; j < c; j++) { h = b._inner[j].x; i = b._inner[j].y; this.j.lineTo(h, i); d = h < d ? h : d; e = i < e ? i : e; f = h > f ? h : f; g = i > g ? i : g; } this.h = d; this.i = e; this.f = f; this.g = g; this.c = true; } else { for (var k = 0; k < c; k++) { this.j.lineTo(b._inner[k].x, b._inner[k].y); } } this.aa = a._points._inner[c - 1]; }; CanvasViewRenderer.prototype.w = function (a) { this.j.rect(a.e.left, a.e.top, a.e.width, a.e.height); if (this.b) { var b = a.e; var c = this.h; var d = this.i; var e = this.f; var f = this.g; var g = b.left; var h = b.right; var i = b.top; var j = b.bottom; this.h = g < c ? g : c; this.i = i < d ? i : d; this.f = h > e ? h : e; this.g = j > f ? j : f; this.c = true; } }; CanvasViewRenderer.prototype.r = function (a) { this.j.moveTo(a.d.x, a.d.y); this.j.lineTo(a.c.x, a.c.y); if (this.b) { var b = a.d; var c = a.c; var d = this.h; var e = this.i; var f = this.f; var g = this.g; var h = b.x < c.x ? b.x : c.x; var i = b.x > c.x ? b.x : c.x; var j = b.y < c.y ? b.y : c.y; var k = b.y > c.y ? b.y : c.y; this.h = h < d ? h : d; this.i = j < e ? j : e; this.f = i > f ? i : f; this.g = k > g ? k : g; this.c = true; } }; CanvasViewRenderer.prototype.h$u = function (a) { if (a._visibility == 0 && a.al != null) { if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = (a._opacity * this.e); } var def_ = this.m; var con_ = this.j; con_.textAlign = def_; this.j.fillStyle = a.ao != null ? a.ao._fill : null; if (a.ag) { this.j.textBaseline = "alphabetic"; this.j.fillText(a.al, a.n, a.o + a.ah); } else { this.j.textBaseline = "top"; this.j.fillText(a.al, a.n, a.o); } if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = 1; } } }; CanvasViewRenderer.prototype.h$v = function (a, b, c) { if (a._visibility == 0) { if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = (a._opacity * this.e); } var d = b.left + b.width / 2; var e = a.al.split(' '); this.j.fillStyle = a.ao._fill; this.j.textBaseline = "top"; this.j.textAlign = "center"; var f = b.width; var g = b.height; var h = b.top; var i = ""; for (var j = 0; j < e.length; j++) { var k = i + e[j]; var l = this.j.measureText(k); if (l.width > f) { if (i != null) { this.j.fillText(i, d, h); } i = ""; h = h + c; } i = i + e[j] + " "; } if (i != null) { this.j.fillText(i, d, h); } if (a._opacity < 1 || this.e < 1) { this.j.globalAlpha = 1; } } }; CanvasViewRenderer.prototype.h$r = function (a) { if (a.an == null || a.an.count < 1) { return; } this.j.beginPath(); this.j.globalAlpha = (a._opacity * this.e); if (a.ai != null) { var b = new Array(a.ai.count); for (var c = 0; c < a.ai.count; c++) { b[c] = a.ai._inner[c]; } this.j.setLineDash(b); } else { this.j.setLineDash(new Array(0)); } var d = a.an; var e = d._inner[0]; var f = a._fill; var g = a._stroke; this.b = (f != null && f.isGradient) || (g != null && g.isGradient); if (this.b) { var h = 1.7976931348623157E+308; var i = -1.7976931348623157E+308; var j = 1.7976931348623157E+308; var k = -1.7976931348623157E+308; var l = e.x; var m = e.y; h = l < h ? l : h; j = m < j ? m : j; i = l > i ? l : i; k = m > k ? m : k; this.j.moveTo(l, m); for (var n = 1; n < d.count; n++) { l = d._inner[n].x; m = d._inner[n].y; this.j.lineTo(l, m); h = l < h ? l : h; j = m < j ? m : j; i = l > i ? l : i; k = m > k ? m : k; } this.j.closePath(); this.h = h; this.i = j; this.f = i; this.g = k; } else { this.j.moveTo(e.x, e.y); for (var o = 1; o < d.count; o++) { this.j.lineTo(d._inner[o].x, d._inner[o].y); } this.j.closePath(); } if (f != null) { if (f.isGradient) { this.j.fillStyle = this.l(f, this.h, this.i, this.f, this.g, a.ad, false); } else { this.j.fillStyle = f._fill; } this.j.fill(); } if (g != null) { if (g.isGradient) { this.j.strokeStyle = this.l(g, this.h, this.i, this.f, this.g, a.ad, true); } else { this.j.strokeStyle = g._fill; } this.j.lineWidth = a.ad; this.j.stroke(); } this.j.globalAlpha = 1; if (a.ai != null) { this.j.setLineDash(new Array(0)); } }; CanvasViewRenderer.prototype.h$s = function (a) { if (a.an == null || a.an.count < 1) { return; } this.j.beginPath(); this.j.globalAlpha = (a._opacity * this.e); if (a.ai != null) { var b = new Array(a.ai.count); for (var c = 0; c < a.ai.count; c++) { b[c] = a.ai._inner[c]; } this.j.setLineDash(b); } else { this.j.setLineDash(new Array(0)); } var d = a.an; var e = d._inner[0]; var f = a._fill; var g = a._stroke; this.b = (f != null && f.isGradient) || (g != null && g.isGradient); if (this.b) { var h = 1.7976931348623157E+308; var i = -1.7976931348623157E+308; var j = 1.7976931348623157E+308; var k = -1.7976931348623157E+308; var l = e.x; var m = e.y; h = l < h ? l : h; j = m < j ? m : j; i = l > i ? l : i; k = m > k ? m : k; this.j.moveTo(l, m); for (var n = 1; n < d.count; n++) { l = d._inner[n].x; m = d._inner[n].y; this.j.lineTo(l, m); h = l < h ? l : h; j = m < j ? m : j; i = l > i ? l : i; k = m > k ? m : k; } this.h = h; this.i = j; this.f = i; this.g = k; } else { this.j.moveTo(e.x, e.y); for (var o = 1; o < d.count; o++) { this.j.lineTo(d._inner[o].x, d._inner[o].y); } } if (f != null) { if (f.isGradient) { this.j.fillStyle = this.l(f, this.h, this.i, this.f, this.g, a.ad, false); } else { this.j.fillStyle = f._fill; } this.j.fill(); } if (g != null) { if (g.isGradient) { this.j.strokeStyle = this.l(g, this.h, this.i, this.f, this.g, a.ad, true); } else { this.j.strokeStyle = g._fill; } this.j.lineWidth = a.ad; this.j.stroke(); } this.j.globalAlpha = 1; if (a.ai != null) { this.j.setLineDash(new Array(0)); } }; CanvasViewRenderer.prototype.h$n = function (a, b) { if (b._visibility == 1) { return; } if ((b._opacity != 1 || this.e != 1) && !a.isHitTestRender) { this.j.globalAlpha = (b._opacity * this.e); } var c = b.ah; if (c != null && c.render != null) { a.context = this.j; a.xPosition = b.n; a.yPosition = b.o; a.data = b.content; c.render(a); } this.j.globalAlpha = 1; }; CanvasViewRenderer.prototype.h$h = function (a) { if (typeCast(TransformGroup.$, a) !== null) { var b = a; for (var c = b.j.count - 1; c >= 0; c--) { var d = b.j._inner[c]; this.h$h(d); } } else if (typeCast(TranslateTransform.$, a) !== null) { var e = a; this.j.translate(e.j, e.k); } else if (typeCast(RotateTransform.$, a) !== null) { var f = a; var g = f.j * Math.PI / 180; var h = Math.cos(g); var i = Math.sin(g); var j = f.k * (1 - h) + f.l * i; var k = f.l * (1 - h) - f.k * i; this.j.transform(h, i, i * -1, h, j, k); } else if (typeCast(ScaleTransform.$, a) !== null) { var l = a; this.j.transform(l.l, 0, 0, l.m, l.j - l.l * l.j, l.k - l.m * l.k); } }; CanvasViewRenderer.prototype.h$p = function (a) { if (a._visibility != 0) { return; } this.j.beginPath(); this.j.globalAlpha = (a._opacity * this.e); if (a.ai != null) { var b = new Array(a.ai.count); for (var c = 0; c < a.ai.count; c++) { b[c] = a.ai._inner[c]; } this.j.setLineDash(b); } else { this.j.setLineDash(new Array(0)); } this.j.moveTo(a.an, a.ap); this.j.lineTo(a.ao, a.aq); if (this.b) { this.h = 1.7976931348623157E+308; this.f = -1.7976931348623157E+308; this.i = 1.7976931348623157E+308; this.g = -1.7976931348623157E+308; var d = this.h; var e = this.i; var f = this.f; var g = this.g; var h = a.an < a.ao ? a.an : a.ao; var i = a.an > a.ao ? a.an : a.ao; var j = a.ap < a.aq ? a.ap : a.aq; var k = a.ap > a.aq ? a.ap : a.aq; this.h = h < d ? h : d; this.i = j < e ? j : e; this.f = i > f ? i : f; this.g = k > g ? k : g; } var l = a._fill; var m = a._stroke; if (l != null) { if (l.isGradient) { this.j.fillStyle = this.l(l, this.h, this.i, this.f, this.f, a.ad, false); } else { this.j.fillStyle = l._fill; } this.j.fill(); } if (m != null) { if (m.isGradient) { this.j.strokeStyle = this.l(m, this.h, this.i, this.f, this.f, a.ad, true); } else { this.j.strokeStyle = a._stroke._fill; } this.j.lineWidth = a.ad; this.j.stroke(); } this.j.globalAlpha = 1; if (a.ai != null) { this.j.setLineDash(new Array(0)); } }; CanvasViewRenderer.prototype.h$ac = function (a) { this.j.beginPath(); this.j.rect(a.left, a.top, a.width, a.height); this.j.clip(); }; CanvasViewRenderer.prototype.h$x = function () { this.j.save(); }; CanvasViewRenderer.prototype.h$w = function () { this.j.restore(); }; CanvasViewRenderer.prototype.h$y = function (a, b) { this.j.scale(a, b); }; CanvasViewRenderer.prototype.h$ad = function (a, b) { this.j.translate(a, b); }; CanvasViewRenderer.prototype.h$i = function (a, b, c, d) { this.j.clearRect(a, b, c, d); }; CanvasViewRenderer.prototype.h$k = function (a, b, c, d, e, f) { if (b != 1) { this.j.globalAlpha = (b * this.e); } this.j.drawImage(a, c, d, e, f); if (b != 1) { this.j.globalAlpha = 1; } }; CanvasViewRenderer.prototype.h$l = function (a, b, c, d, e, f, g, h, i, j) { if (b != 1) { this.j.globalAlpha = (b * this.e); } this.j.drawImage(a, c, d, e, f, g, h, i, j); if (b != 1) { this.j.globalAlpha = 1; } }; CanvasViewRenderer.prototype.h$a = function (a, b) { var c = this.j.getImageData(a, b, 1, 1); var d = new Array(4); d[0] = c.data[0]; d[1] = c.data[1]; d[2] = c.data[2]; d[3] = c.data[3]; return d; }; CanvasViewRenderer.prototype.h$f = function () { return this.j.font; }; CanvasViewRenderer.prototype.h$b = function () { return this.a; }; CanvasViewRenderer.prototype.h$z = function (a) { if (this.j.font != a) { this.j.font = a; } }; CanvasViewRenderer.prototype.h$aa = function (a) { this.a = a; if (a != null) { this.d = a.f; } var b = a != null ? a.fontString : null; if (this.j.font != b) { this.j.font = b; } }; CanvasViewRenderer.prototype.h$ae = function (a, b, c) { this.j.textBaseline = "alphabetic"; var d = this.j.measureText(a); var metrics_ = d; var e = b; var f = new TextFontMetrics(); if ((metrics_.actualBoundingBoxAscent !== undefined)) { f.a = (metrics_.actualBoundingBoxAscent); e = (metrics_.actualBoundingBoxAscent + metrics_.actualBoundingBoxDescent); if (c) { var g = (b - e); var h = g / 2; f.a += h; e += g; } } f.c = d.width; f.b = e; return f; }; CanvasViewRenderer.prototype.h$c = function (a) { var b = this.j.measureText(a); return b.width; }; CanvasViewRenderer.prototype.h$ab = function (a) { this.e = a; }; CanvasViewRenderer.prototype.h$g = function (shape_, style_) { if (style_ == null) { return; } var fillColor_ = null; var strokeColor_ = null; var strokeThickness_ = NaN; var opacity_ = NaN; var s_ = style_; if (s_.fill) { fillColor_ = s_.fill; } ; if (s_.stroke) { strokeColor_ = s_.stroke; } ; if (s_.strokeThickness) { strokeThickness_ = s_.strokeThickness; } ; if (s_.opacity) { opacity_ = s_.opacity; } ; if (fillColor_ != null) { shape_._fill = ((function () { var $ret = new Brush(); $ret.fill = fillColor_; return $ret; })()); } if (strokeColor_ != null) { shape_._stroke = ((function () { var $ret = new Brush(); $ret.fill = strokeColor_; return $ret; })()); } if (strokeThickness_ != undefined && !isNaN_(strokeThickness_)) { shape_.ad = strokeThickness_; } if (!isNaN_(opacity_)) { shape_._opacity = opacity_; } }; CanvasViewRenderer.prototype.h$m = function (a, b, c, d) { this.j.shadowColor = a; this.j.shadowBlur = b; this.j.shadowOffsetX = c; this.j.shadowOffsetY = d; }; CanvasViewRenderer.prototype.h$j = function () { this.j.shadowColor = "rgba(0,0,0,0)"; this.j.shadowBlur = 0; this.j.shadowOffsetX = 0; this.j.shadowOffsetY = 0; }; CanvasViewRenderer.$t = markType(CanvasViewRenderer, 'CanvasViewRenderer', Base.$, [IRenderer_$type]); return CanvasViewRenderer; }(Base)); export { CanvasViewRenderer };