igniteui-angular-gauges
Version:
Ignite UI Angular gauge components.
740 lines (739 loc) • 22.7 kB
JavaScript
/*
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 { Base, Point_$type, markType } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
* @hidden
*/
export let RadialGaugeNeedlePreparer = /*@__PURE__*/ (() => {
class RadialGaugeNeedlePreparer extends Base {
constructor() {
super(...arguments);
this.b = null;
}
e(a) {
let b = this.b;
a.aj = b.t;
a.ak = b.u;
a.ah = b.r;
a.ai = b.s;
a.ae = b.o;
a.aa = b.h;
switch (b.b) {
case 0:
this.i(a);
break;
case 1:
this.j(a);
break;
case 2:
this.n(a);
break;
case 4:
this.l(a);
break;
case 5:
this.k(a);
break;
case 3:
this.g(a);
break;
case 7:
this.h(a);
break;
case 8:
this.m(a);
break;
case 6:
this.o(a);
break;
}
switch (b.c) {
case 3:
this.d(a, true, false);
break;
case 5:
this.d(a, false, false);
break;
case 4:
this.d(a, true, true);
break;
case 6:
this.d(a, false, true);
break;
}
}
d(a, b, c) {
let d = this.a();
let e = d.i;
let f = d.g;
let g = d.f;
let h = a.m;
if (b) {
h = a.i;
}
let i = h.f;
h.b = true;
h.c = true;
h.d = false;
h.h = e;
i.add({ $type: Point_$type, x: 0 + e, y: 0 });
i.add({ $type: Point_$type, x: 0 - e, y: 0 });
h = a.p;
if (b) {
h = a.l;
}
i = h.f;
h.b = true;
h.c = true;
h.d = true;
h.h = e;
i.add({ $type: Point_$type, x: 0 - e, y: 0 });
i.add({ $type: Point_$type, x: 0 + e, y: 0 });
if (c) {
h = a.n;
if (b) {
h = a.j;
}
i = h.f;
h.b = true;
h.c = false;
h.d = false;
h.h = g;
i.add({ $type: Point_$type, x: 0 + g, y: 0 });
i.add({ $type: Point_$type, x: 0 - g, y: 0 });
h = a.o;
if (b) {
h = a.k;
}
i = h.f;
h.b = true;
h.c = false;
h.d = true;
h.h = g;
i.add({ $type: Point_$type, x: 0 - g, y: 0 });
i.add({ $type: Point_$type, x: 0 + g, y: 0 });
}
}
o(a) {
this.f(a, false, true, false, true);
}
m(a) {
this.f(a, false, false, true, true);
}
l(a) {
this.f(a, false, false, true, false);
}
n(a) {
this.f(a, false, true, false, false);
}
h(a) {
this.f(a, false, false, false, true);
}
c(a, b, c, d, e) {
let f = 0;
if (c == a) {
f = 0;
}
else {
f = (e - a) / (c - a);
}
let g = b + (d - b) * f;
return g;
}
f(a, b, c, d, e) {
this.p(a);
let f = this.a();
a.ad = f.m;
a.ac = f.k;
a.af = 0;
if (!isNaN_(f.l)) {
a.af = Math.max(a.af, f.l);
}
if (!isNaN_(f.i)) {
a.af = Math.max(a.af, f.i);
}
if (!isNaN_(f.q)) {
a.af = Math.max(a.af, f.q);
}
if (!isNaN_(f.e)) {
a.af = Math.max(a.af, f.e);
}
if (c) {
f.p = f.k;
f.q = 0;
}
if (d) {
f.p = f.k;
f.q = f.l;
}
if (b) {
let g = Math.max(f.n, f.l);
f.n = g;
f.l = g;
f.p = f.k;
f.q = f.l;
}
if (isNaN_(f.p)) {
f.p = f.k;
}
let h = f.c == 1 || f.c == 2;
let i = f.n;
let j = f.l;
if (!d && !b) {
j = 0;
}
let k = f.q;
let l = f.i;
let m = f.m;
let n = f.k;
let o = f.d;
let p = f.p;
let q = f.e;
let r = true;
let s = true;
if (isNaN_(p)) {
r = false;
p = n;
}
if (isNaN_(o)) {
s = false;
o = m;
}
let t = f.f;
let u = f.g;
let v = 0;
let w = u;
let x = u;
let y = this.c(m, i, p, k, u);
let z = y;
let aa = f.c == 2;
if (h) {
let ab = GeometryUtil.r({ $type: Point_$type, x: m, y: i }, { $type: Point_$type, x: p, y: k }, { $type: Point_$type, x: 0, y: 0 }, l);
if (isNaN_(ab.c.x) || isNaN_(ab.c.y) || isNaN_(ab.d.x) || isNaN_(ab.d.y)) {
h = false;
}
else {
let ac = ab.c;
let ad = ab.d;
w = ac.x;
x = ad.x;
y = ac.y;
z = ad.y;
if (w > x) {
let ae = w;
w = x;
x = ae;
ae = y;
y = z;
z = ae;
}
}
}
if (aa) {
let af = GeometryUtil.r({ $type: Point_$type, x: m, y: i }, { $type: Point_$type, x: p, y: k }, { $type: Point_$type, x: 0, y: 0 }, t);
if ((isNaN_(af.c.x) || isNaN_(af.c.y) || isNaN_(af.d.x) || isNaN_(af.d.y)) || h) {
aa = true;
}
else {
aa = false;
}
}
if (m > x || n < w) {
h = false;
w = m;
x = m;
}
let ag = false;
let ah = false;
if (h && m >= w) {
ag = true;
}
if (h && n <= x) {
ah = true;
}
if (isNaN_(o) || o > w) {
o = w;
}
if (p < x) {
p = x;
}
let ai = e;
let aj = l;
let ak = l;
if (o + q > w) {
ai = false;
}
let al = o;
let am = i;
let an = o;
let ao = i;
let ap = w;
let aq = x;
let ar = y;
let as = z;
let at = w;
let au = x;
let av = y;
let aw = z;
if (ai) {
let ax = GeometryUtil.r({ $type: Point_$type, x: m, y: i }, { $type: Point_$type, x: p, y: k }, { $type: Point_$type, x: o, y: 0 }, q);
if ((!isNaN_(ax.c.x) && !isNaN_(ax.c.y) && !isNaN_(ax.d.x) && !isNaN_(ax.d.y))) {
ai = true;
al = ax.c.x;
am = ax.c.y;
an = ax.d.x;
ao = ax.d.y;
if (al > an) {
let ay = al;
al = an;
an = ay;
ay = am;
am = ao;
ao = ay;
}
}
else {
ai = false;
}
}
if (ag) {
ai = false;
}
if (ai && m >= al) {
ag = true;
aj = q;
ap = al;
ar = am;
aq = an;
as = ao;
}
if (ai && n <= an) {
ah = true;
ak = q;
ak = q;
at = al;
av = am;
au = an;
aw = ao;
}
let az = m;
let a0 = a.a;
let a1 = a0.f;
let a2 = i;
if (ag) {
az = ap;
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = aj;
o = ap;
m = ap;
a2 = ar;
i = ar;
h = false;
}
if (ah) {
p = au;
n = au;
h = false;
}
let a3 = ag || ah || h;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.d;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: a2 });
az = al;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.b;
a1 = a0.f;
if (ai) {
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = q;
}
a1.add({ $type: Point_$type, x: az, y: a2 });
az = an;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.t;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: a2 });
az = w;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.e;
a1 = a0.f;
if (a3) {
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = l;
}
a1.add({ $type: Point_$type, x: az, y: a2 });
az = x;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.f;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: a2 });
az = p;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.x;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: a2 });
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.v;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: a2 });
az = n;
a2 = this.c(p, k, n, j, az);
a1.add({ $type: Point_$type, x: az, y: a2 });
a0 = a.w;
a1 = a0.f;
if (ah) {
az = au;
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = ak;
}
a1.add({ $type: Point_$type, x: az, y: a2 });
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.z;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = p;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.y;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.u;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = x;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.h;
a1 = a0.f;
if (a3) {
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = l;
}
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = w;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.g;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = an;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.c;
a1 = a0.f;
if (ai) {
a0.b = true;
a0.d = false;
a0.c = false;
a0.h = q;
}
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = al;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.s;
a1 = a0.f;
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
az = m;
a2 = this.c(m, i, p, k, az);
a1.add({ $type: Point_$type, x: az, y: -1 * a2 });
a0 = a.q;
a1 = a0.f;
if (aa && a3) {
a0.b = true;
a0.c = true;
a0.d = false;
a0.h = t;
a1.add({ $type: Point_$type, x: 0 + t, y: 0 });
a1.add({ $type: Point_$type, x: 0 - t, y: 0 });
}
a0 = a.r;
a1 = a0.f;
if (aa && a3) {
a0.b = true;
a0.c = true;
a0.d = true;
a0.h = t;
a1.add({ $type: Point_$type, x: 0 - t, y: 0 });
a1.add({ $type: Point_$type, x: 0 + t, y: 0 });
}
}
g(a) {
this.f(a, false, false, false, false);
}
k(a) {
this.f(a, true, false, false, true);
}
a() {
let a = this.b;
let b = this.b.a();
let c = 0;
let d = 0.48;
let e = NaN;
let f = NaN;
let g = 0.15;
let h = 0.1;
let i = 0.1;
let j = 0.1;
let k = 0.14;
let l = 0.06;
switch (a.b) {
case 3:
f = 0.4;
break;
case 4:
h = 0.06;
i = 0.02;
break;
case 7:
f = 0.4;
c = -0.3;
e = -0.2;
k = 0.14;
break;
case 5:
c = -0.3;
e = -0.2;
k = 0.14;
break;
case 8:
i = 0.06;
c = -0.3;
e = -0.2;
k = 0.14;
break;
case 6:
c = -0.3;
e = -0.2;
k = 0.14;
break;
}
let m = a.m;
let n = a.k;
let o = a.c == 1 || a.c == 2;
if (isNaN_(m)) {
m = c;
}
if (isNaN_(n)) {
n = d;
}
let p = Math.min(m, n);
let q = Math.max(m, n);
m = p;
n = q;
let r = a.n;
if (isNaN_(r)) {
r = h;
}
let s = a.l;
if (isNaN_(s)) {
s = i;
}
let t = a.i;
let u = a.f;
if (isNaN_(t)) {
t = g;
}
if (isNaN_(u)) {
u = j;
}
let v = Math.max(t, u);
let w = Math.min(t, u);
t = v;
u = w;
let x = a.d;
if (isNaN_(x)) {
x = e;
}
if (!isNaN_(x)) {
if (x < m) {
x = NaN;
}
if (x > 0 && m <= 0) {
x = NaN;
}
if (x > n) {
x = n;
}
}
let y = a.p;
if (isNaN_(y)) {
y = f;
}
if (!isNaN_(y)) {
if (y > n) {
y = NaN;
}
if (y < 0 && n >= 0) {
y = NaN;
}
if (y < m) {
y = m;
}
}
let z = 0;
if (m > 0) {
z = m;
}
if (n < 0) {
z = m;
}
if (t <= 0) {
t = 0;
}
let aa = a.e;
let ab = a.q;
if (isNaN_(aa)) {
aa = k;
}
if (isNaN_(ab)) {
ab = l;
}
b.i = t / 2;
b.f = u / 2;
b.d = x;
b.p = y;
b.m = m;
b.k = n;
b.g = z;
b.n = r / 2;
b.l = s / 2;
b.q = ab / 2;
b.e = aa / 2;
return b;
}
j(a) {
this.f(a, true, false, false, false);
}
p(a) {
a.a.k();
a.d.k();
a.b.k();
a.t.k();
a.e.k();
a.f.k();
a.x.k();
a.v.k();
a.w.k();
a.z.k();
a.y.k();
a.u.k();
a.h.k();
a.g.k();
a.c.k();
a.s.k();
a.q.k();
a.r.k();
a.i.k();
a.l.k();
a.m.k();
a.p.k();
a.j.k();
a.k.k();
a.n.k();
a.o.k();
}
i(a) {
this.p(a);
let b = 0;
let c = 0;
let d = 0;
let e = 0;
let f = 0;
let g = 0;
let h = 0;
let i = a.a;
let j = i.f;
j.add({ $type: Point_$type, x: b, y: h });
j.add({ $type: Point_$type, x: b, y: g });
i = a.d;
j = i.f;
j.add({ $type: Point_$type, x: b, y: g });
j.add({ $type: Point_$type, x: d, y: g });
i = a.b;
j = i.f;
j.add({ $type: Point_$type, x: d, y: g });
j.add({ $type: Point_$type, x: d, y: g });
let k = f;
let l = f;
i = a.t;
j = i.f;
j.add({ $type: Point_$type, x: d, y: g });
j.add({ $type: Point_$type, x: k, y: g });
i = a.e;
j = i.f;
j.add({ $type: Point_$type, x: k, y: g });
j.add({ $type: Point_$type, x: l, y: g });
i = a.f;
j = i.f;
j.add({ $type: Point_$type, x: l, y: g });
j.add({ $type: Point_$type, x: e, y: g });
i = a.x;
j = i.f;
j.add({ $type: Point_$type, x: e, y: g });
j.add({ $type: Point_$type, x: e, y: g });
i = a.v;
j = i.f;
j.add({ $type: Point_$type, x: e, y: g });
j.add({ $type: Point_$type, x: c, y: g });
i = a.w;
j = i.f;
j.add({ $type: Point_$type, x: c, y: g });
j.add({ $type: Point_$type, x: c, y: h });
i = a.z;
j = i.f;
j.add({ $type: Point_$type, x: c, y: h });
j.add({ $type: Point_$type, x: e, y: h });
i = a.y;
j = i.f;
j.add({ $type: Point_$type, x: e, y: h });
j.add({ $type: Point_$type, x: e, y: h });
i = a.u;
j = i.f;
j.add({ $type: Point_$type, x: e, y: h });
j.add({ $type: Point_$type, x: l, y: h });
i = a.h;
j = i.f;
j.add({ $type: Point_$type, x: l, y: h });
j.add({ $type: Point_$type, x: k, y: h });
i = a.g;
j = i.f;
j.add({ $type: Point_$type, x: k, y: h });
j.add({ $type: Point_$type, x: d, y: h });
i = a.c;
j = i.f;
j.add({ $type: Point_$type, x: d, y: h });
j.add({ $type: Point_$type, x: d, y: h });
i = a.s;
j = i.f;
j.add({ $type: Point_$type, x: d, y: h });
j.add({ $type: Point_$type, x: b, y: h });
}
}
RadialGaugeNeedlePreparer.$t = markType(RadialGaugeNeedlePreparer, 'RadialGaugeNeedlePreparer');
return RadialGaugeNeedlePreparer;
})();