igniteui-angular-gauges
Version:
Ignite UI Angular gauge components.
2,235 lines • 81 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 { Control } from "igniteui-angular-core";
import { INotifyPropertyChanged_$type, Base, PropertyChangedEventArgs, runOn, delegateCombine, enumGetBox, Number_$type, String_$type, Array_$type, Point_$type, delegateRemove, fromEn, markType, markDep, typeCast, fromEnum, TypeRegistrar } from "igniteui-angular-core";
import { DoubleAnimator } from "igniteui-angular-core";
import { LinearGaugeFrame } from "./LinearGaugeFrame";
import { LinearGraphScaler } from "./LinearGraphScaler";
import { LinearScaleOrientation_$type } from "./LinearScaleOrientation";
import { DependencyProperty } from "igniteui-angular-core";
import { LinearGraphRangeCollection } from "./LinearGraphRangeCollection";
import { BrushCollection } from "igniteui-angular-core";
import { LinearGraphNeedleShape_$type } from "./LinearGraphNeedleShape";
import { Brush } from "igniteui-angular-core";
import { BindingFormatter } from "igniteui-angular-core";
import { HighlightedValueDisplayMode_$type } from "igniteui-angular-core";
import { StackPool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { TextBlock } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { FormatLinearGraphLabelEventArgs } from "./FormatLinearGraphLabelEventArgs";
import { AlignLinearGraphLabelEventArgs } from "./AlignLinearGraphLabelEventArgs";
import { DoubleValueChangedEventArgs } from "igniteui-angular-core";
import { PolygonUtil } from "igniteui-angular-core";
import { LinearGaugeVisualData } from "./LinearGaugeVisualData";
import { ToolTipInfo } from "./ToolTipInfo";
import { RectData } from "igniteui-angular-core";
import { LinearGraphScaleLabelVisualDataList } from "./LinearGraphScaleLabelVisualDataList";
import { LinearGraphScaleTickmarkVisualDataList } from "./LinearGraphScaleTickmarkVisualDataList";
import { LinearGraphRangeVisualDataList } from "./LinearGraphRangeVisualDataList";
import { LinearNeedleVisualData } from "./LinearNeedleVisualData";
import { LinearGraphRangeVisualData } from "./LinearGraphRangeVisualData";
import { LinearGraphToolTipVisualData } from "./LinearGraphToolTipVisualData";
import { LinearGraphTooltipDataContext } from "./LinearGraphTooltipDataContext";
import { AppearanceHelper } from "igniteui-angular-core";
import { PointData } from "igniteui-angular-core";
import { PathVisualData } from "igniteui-angular-core";
import { GetPointsSettings } from "igniteui-angular-core";
import { LinearGraphRectFrame } from "./LinearGraphRectFrame";
import { Size } from "igniteui-angular-core";
import { Tuple$2 } from "igniteui-angular-core";
import { LinearGraphNeedleParameters } from "./LinearGraphNeedleParameters";
import { LinearGraphNeedleFrame } from "./LinearGraphNeedleFrame";
import { BrushUtil } from "igniteui-angular-core";
import { LinearGraphNeedlePreparer } from "./LinearGraphNeedlePreparer";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity, intDivide, truncate } from "igniteui-angular-core";
import { EventProxy } from "igniteui-angular-core";
import { RenderingContext } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { CanvasScalingHelpers } from "igniteui-angular-core";
import { CanvasViewRenderer } from "igniteui-angular-core";
import { CanvasGestureDOMEventProxy } from "igniteui-angular-core";
import { LinearGraphScaleLabelVisualData } from "./LinearGraphScaleLabelVisualData";
import { LinearGraphScaleTickmarkVisualData } from "./LinearGraphScaleTickmarkVisualData";
import { SizeData } from "igniteui-angular-core";
import { arrayCopy1 } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
* @hidden
*/
export let XamLinearGauge = /*@__PURE__*/ (() => {
class XamLinearGauge extends Control {
constructor() {
super();
this.propertyChanged = null;
this.av = null;
this.b1 = 0;
this.formatLabel = null;
this.alignLabel = null;
this.valueChanged = null;
this.highlightValueChanged = null;
this.ao = null;
this.an = null;
this.am = null;
this.ar = null;
this.by = 0;
this.bx = 100;
this.a3 = 0;
this.aj = null;
this.a2 = 0;
this.bw = 0.5;
this.az = 1;
this.bn = false;
this.a7 = null;
this.a5 = null;
this.a4 = null;
this.a8 = null;
this.a6 = null;
this.bu = null;
this.i0 = null;
this.bt = null;
this.iz = null;
this._view = null;
this.i2 = null;
this.i1 = null;
this.iy = null;
this.bp = new List$1(TextBlock.$, 0);
this.bs = new List$1(TextBlock.$, 0);
this.br = new List$1(Path.$, 0);
this.bq = new List$1(Path.$, 0);
this.bc = false;
this.b0 = NaN;
this.bz = 1;
this.b0 = NaN;
this.bz = 1;
this.view = new XamLinearGaugeView(this);
this.view.bc();
this.i2 = Rect.empty;
this.i1 = Rect.empty;
this.iy = Rect.empty;
this.ao = new LinearGaugeFrame();
this.an = new LinearGaugeFrame();
this.am = new LinearGaugeFrame();
this.ranges = new LinearGraphRangeCollection();
this.bc = true;
this.av = new DoubleAnimator(0, 1, this.di);
let a = this.av;
a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.fn));
this.ab = XamLinearGauge.$;
this.a6 = ((() => {
let $ret = new StackPool$1(Path.$);
$ret.b = runOn(this.view, this.view.bm);
$ret.c = runOn(this.view, this.view.bn);
$ret.d = runOn(this.view, this.view.bo);
$ret.j = runOn(this.view, this.view.cq);
return $ret;
})());
this.a7 = ((() => {
let $ret = new StackPool$1(Path.$);
$ret.b = runOn(this.view, this.view.bf);
$ret.c = runOn(this.view, this.view.bg);
$ret.d = runOn(this.view, this.view.bh);
$ret.j = runOn(this.view, this.view.cp);
return $ret;
})());
this.a5 = ((() => {
let $ret = new StackPool$1(Path.$);
$ret.b = runOn(this.view, this.view.bf);
$ret.c = runOn(this.view, this.view.bg);
$ret.d = runOn(this.view, this.view.bh);
$ret.j = runOn(this.view, this.view.cp);
return $ret;
})());
this.a4 = ((() => {
let $ret = new StackPool$1(TextBlock.$);
$ret.b = runOn(this.view, this.view.a4);
$ret.c = runOn(this.view, this.view.a5);
$ret.d = runOn(this.view, this.view.a6);
$ret.j = runOn(this.view, this.view.b3);
return $ret;
})());
this.a8 = ((() => {
let $ret = new StackPool$1(TextBlock.$);
$ret.b = runOn(this.view, this.view.bw);
$ret.c = runOn(this.view, this.view.bx);
$ret.d = runOn(this.view, this.view.by);
$ret.j = runOn(this.view, this.view.b4);
return $ret;
})());
}
f4(a) {
this.gb(a);
}
gb(a) {
let b = this.propertyChanged;
if (b != null) {
b(this, new PropertyChangedEventArgs(a));
}
}
fn(a, b) {
this.dd = this.av.o;
}
get a9() {
return this.av.f();
}
get dd() {
return this.b1;
}
set dd(a) {
let b = this.b1;
this.b1 = a;
this.f3("TransitionProgress", b, this.b1);
}
gn() {
this.b1 = 0;
this.av.w();
this.av.v();
}
get bm() {
return this.di > 0;
}
onDetachedFromUI() {
this.view.bb();
}
onAttachedToUI() {
this.view.a7();
}
get b4() {
return this.by;
}
set b4(a) {
this.by = a;
}
get b3() {
return this.bx;
}
set b3(a) {
this.bx = a;
}
get b2() {
return this.bw;
}
set b2(a) {
let b = this.bw;
this.bw = a;
if (b != this.bw) {
this.f3("ActualHighlightValueOpacity", b, a);
}
}
gq() {
this.b2 = isNaN_(this.cb) ? 0.5 : Math.max(0, Math.min(this.cb, 1));
}
get a0() {
return this.az;
}
set a0(a) {
this.az = a;
}
gp() {
if (this.a1 != 1) {
if (isNaN_(this.ca) || isInfinity(this.ca)) {
this.a0 = 1;
}
else {
this.a0 = 2;
}
}
else {
this.a0 = 1;
}
}
ft() {
this.a2 = 0;
this.view.cm().an = null;
}
b9(a) {
let b = 0;
let c = a.x;
if (this.as == 1) {
b = a.y;
c = this.i5.height;
}
return this.ar.k(c - b);
}
bk(a) {
if (this.bu == null) {
return false;
}
return PolygonUtil.b(this.bu, a);
}
ba(a) {
if (this.bt == null) {
return false;
}
return PolygonUtil.b(this.bt, a);
}
needleContainsPoint(a, b) {
if (this.bu == null) {
return false;
}
return b ? this.i0.containsPoint(a) : PolygonUtil.b(this.bu, a);
}
highlightNeedleContainsPoint(a, b) {
if (this.bt == null) {
return false;
}
return b ? this.iz.containsPoint(a) : PolygonUtil.b(this.bt, a);
}
fr(a, b) {
let c = this.b9(a);
c = Math.max(Math.min(c, this.b3), this.b4);
let d = this.a3 == 2;
if (d) {
if (c != this.ca) {
this.ca = c;
}
}
else {
if (c != this.de) {
this.de = c;
}
}
}
at() {
let a = new LinearGaugeVisualData();
a.viewport = new RectData(this.i5.left, this.i5.top, this.i5.width, this.i5.height);
a.scaleLabels = new LinearGraphScaleLabelVisualDataList();
a.scaleTickmarks = new LinearGraphScaleTickmarkVisualDataList();
a.ranges = new LinearGraphRangeVisualDataList();
a.needle = ((() => {
let $ret = new LinearNeedleVisualData();
$ret.value = this.de;
return $ret;
})());
a.highlightNeedle = ((() => {
let $ret = new LinearNeedleVisualData();
$ret.value = this.ca;
return $ret;
})());
this.view.az(a);
let b = this.view.l();
if (b != null) {
let c = null;
switch (b.c) {
case "range":
c = a.ranges._inner[b.b];
break;
case "needle":
c = a.needle;
break;
}
a.toolTip = ((() => {
let $ret = new LinearGraphToolTipVisualData();
$ret.item = c;
$ret.itemBrush = AppearanceHelper.b(b.a.brush);
$ret.outline = AppearanceHelper.b(b.a.outline);
$ret.thickness = b.a.thickness;
return $ret;
})());
}
return a;
}
ds() {
let a = this.at();
a.scaleByViewport();
return a.serialize();
}
fs() {
this.view.flush();
}
destroy() {
this.provideContainer(null);
}
provideContainer(a) {
this.view.a9(a);
}
onMouseOver(a, b, c) {
if (this.bn) {
this.gm(a, null);
}
}
onMouseLeave() {
if (this.bn) {
this.gm({ $type: Point_$type, x: -10000, y: -10000 }, null);
}
}
onMouseMove(a, b) {
if (this.a3 != 0) {
this.fr(a, b);
}
}
onMouseDown(a, b) {
if (this.bf && this.a3 == 0 && this.needleContainsPoint(a, b)) {
this.a3 = 1;
}
if (this.be && this.a3 == 0 && this.highlightNeedleContainsPoint(a, b)) {
this.a3 = 2;
}
}
get bd() {
return this.a3 != 0;
}
onMouseUp(a) {
if (this.a3 != 0) {
this.a3 = 0;
}
}
containerResized() {
this.view.ba();
}
go() {
this.view.bv();
}
gm(a, b) {
let c = this.bu;
if (c != null && c.count > 0) {
let d = PolygonUtil.b(c, a);
if (d == true) {
this.view.bu(a, b, -1, "needle");
return;
}
}
for (let e = 0; e < this.bq.count; e++) {
let f = new PathVisualData(1, "range", this.bq._inner[e]);
let g = f.getPoints(new GetPointsSettings());
if (g.count > 0) {
let h = PolygonUtil.b(this.bv(g._inner[0]), a);
if (h == true) {
this.view.bu(a, b, e, "range");
return;
}
}
}
this.view.a2();
}
gg() {
if (!this.bc) {
return;
}
let a = this.an.c;
if (this.as == 0) {
let b = 0;
for (let c = 0; c < a.c.length; c++) {
b = Math.max(b, a.c[c]);
}
let d = this.i5.height >= b ? this.i5.height - b : this.i5.height;
this.i4 = new Rect(0, 0, 0, this.i5.width, d);
}
else {
let e = 0;
for (let f = 0; f < a.f.length; f++) {
e = Math.max(e, a.f[f]);
}
let g = this.i5.width >= e ? this.i5.width - e : this.i5.width;
this.i4 = new Rect(0, e, 0, g, this.i5.height);
}
}
get view() {
return this._view;
}
set view(a) {
this._view = a;
}
get i5() {
return this.i2;
}
set i5(a) {
let b = this.i2;
this.i2 = a;
if (!b.equals1(this.i2)) {
this.f5(b, this.i2);
}
}
get i4() {
return this.i1;
}
set i4(a) {
this.i1 = a;
}
get i3() {
return this.iy;
}
set i3(a) {
this.iy = a;
}
bh() {
return !isNaN_(this.b4) && !isNaN_(this.b3) && !this.i5.isEmpty && this.view.s();
}
fo() {
if (!this.bh()) {
return;
}
let a = this.c5();
this.ar = new LinearGraphScaler(this.b4, this.b3, a, a + this.c3(), this.bg);
if (this.bc) {
if (this.a9) {
if (this.av.g) {
this.av.t();
}
let b = this.ao;
this.ao = this.am;
this.am = b;
}
else {
let c = this.ao;
this.ao = this.an;
this.an = c;
}
}
else if (this.a9) {
this.am.d(this.dd, this.ao, this.an);
this.gh(this.am);
this.gk(this.am);
this.gj(this.am, this.am.c.af, true);
this.gj(this.am, this.am.c.ag, false);
}
if (this.bc) {
this.f7();
this.gg();
if (this.a2 == 1) {
this.a2 = 2;
this.f9(this.ar.i(this.de), this.ao.c, false, true);
}
else if (this.a2 == 4) {
if (this.di > 0) {
this.a2 = 5;
this.f9(this.ar.i(this.de), this.an.c, false, true);
}
else {
this.ft();
}
}
this.f8();
this.ga();
this.f6();
}
if (this.bc && this.bm) {
this.gn();
this.am.d(this.dd, this.ao, this.an);
this.gh(this.am);
this.gk(this.am);
this.gj(this.am, this.am.c.af, true);
this.gj(this.am, this.am.c.ag, false);
this.gl(this.am);
this.gi(this.am);
}
else {
if (this.bc) {
this.gh(this.an);
this.gk(this.an);
this.gj(this.an, this.an.c.af, true);
this.gj(this.an, this.an.c.ag, false);
this.gl(this.an);
this.gi(this.an);
}
}
this.bc = false;
this.view.as();
}
ga() {
let a = this.an;
let b = a.c;
let c = this.ar;
let d = this.cj;
let e = this.i4;
b.u = this.c6;
b.r = this.c1;
b.s = this.c2;
b.t = this.c4;
b.m.clear();
for (let f = 0; f < this.ranges.count; f++) {
let g = this.ranges._inner[f];
if (g.j <= this.b4 || g.o > this.b3) {
continue;
}
let h = g.o;
let i = g.j;
if (h < this.b4) {
h = this.b4;
}
if (i > this.b3) {
i = this.b3;
}
let j = new LinearGraphRectFrame();
j.i = g.an != null ? g.an : this.iq(f, this.ah);
j.j = g.ao != null ? g.ao : this.iq(f, this.ai);
j.h = g.p;
j.g = c.i(h);
j.d = c.i(i);
j.e = g.l;
j.b = g.k;
j.f = g.n;
j.c = g.m;
if (isNaN_(j.e)) {
j.e = this.cy;
}
j.b = g.k;
if (isNaN_(j.b)) {
j.b = this.cy;
}
j.f = g.n;
if (isNaN_(j.f)) {
j.f = this.cz;
}
j.c = g.m;
if (isNaN_(j.c)) {
j.c = this.cz;
}
b.m.add(j);
}
b.ab = this.ip;
b.ad = this.iw;
b.x = this.dc;
b.w = this.db;
b.v = this.c8;
b.ac = this.ir;
b.q = this.cm;
b.p = this.cl;
b.o = this.ck;
let k = this.cc;
if (isNaN_(k)) {
k = (this.b3 - this.b4) / 10;
}
if (k == 0) {
k = this.b3 - this.b4;
}
let l = new List$1(Number_$type, 0);
let m = new List$1(Number_$type, 0);
if (k > 0) {
let n = this.b4 + this.c9;
let o = this.b3 - this.da;
let p = 100000;
let q = Math.abs(o - n) / p;
if (k >= q) {
for (let r = n; r <= o || this.bo(r, o, k); r = r + k) {
l.add(c.i(r));
for (let s = 0; s < d; s++) {
let t = (k / (d + 1)) * (s + 1);
if (t + r > o) {
continue;
}
m.add(c.i(t + r));
}
}
}
}
if (b.j.length != l.count || b.i.length != m.count) {
b.j = new Array(l.count);
b.i = new Array(m.count);
}
for (let u = 0; u < l.count; u++) {
b.j[u] = l._inner[u];
}
for (let v = 0; v < m.count; v++) {
b.i[v] = m._inner[v];
}
}
i6() {
if (!this.bi) {
return new Size(1, 0, 0);
}
let a = this.cc;
let b = this.ce;
if (isNaN_(a)) {
a = (this.b3 - this.b4) / 10;
}
if (isNaN_(b)) {
b = a;
}
if (b == 0) {
b = this.b3 - this.b4;
}
let c = new List$1(Number_$type, 0);
if (b > 0) {
let d = this.cf + this.b4;
let e = this.b3 - this.cg;
let f = 100000;
let g = Math.abs(e - d) / f;
if (b >= g) {
for (let h = d; h <= e || this.bo(h, e, a); h += b) {
c.add(h);
}
}
}
let i = new Array(c.count);
let j = new Array(c.count);
for (let k = 0; k < c.count; k++) {
let l = c._inner[k];
if (this.formatLabel == null && this.aj == null) {
l = (Math.round(l * 100) / 100);
}
let m = l.toString();
if (this.aj != null) {
m = this.aj.i(l);
}
let n = new FormatLinearGraphLabelEventArgs();
n.value = l;
n.label = m;
if (this.formatLabel != null) {
this.formatLabel(this, n);
}
m = n.label;
let o = this.view.cr(((() => {
let $ret = new TextBlock();
$ret.al = m;
return $ret;
})()));
i[k] = o.width;
j[k] = o.height;
}
let p = 0;
let q = 0;
let r = 1 - this.c1 + this.c6;
if (this.as == 0) {
for (let s = 0; s < j.length; s++) {
q = Math.max(q, j[s]);
}
for (let t = 0; t < i.length; t++) {
p += i[t];
}
if (i.length > 0) {
p += i[0] / 2;
}
if (i.length > 1) {
p += i[i.length - 1] / 2;
}
if (i.length > 0) {
p += (i.length - 1) * 5;
}
if (r > 0) {
p = p / Math.abs(1 - r);
}
}
else {
for (let u = 0; u < i.length; u++) {
p = Math.max(p, i[u]);
}
for (let v = 0; v < j.length; v++) {
q += j[v];
}
if (j.length > 0) {
q -= j[0] / 2;
}
if (j.length > 1) {
q -= j[j.length - 1] / 2;
}
if (r > 0) {
q = q / Math.abs(1 - r);
}
if (j.length > 0) {
q += (j.length - 1) * 5;
}
}
return new Size(1, p, q);
}
f7() {
let a = this.an;
let b = a.c;
let c = this.ar;
let d = this.cc;
let e = this.ce;
let f = this.cj;
if (isNaN_(d)) {
d = (this.b3 - this.b4) / 10;
}
if (isNaN_(e)) {
e = d;
}
if (e == 0) {
e = this.b3 - this.b4;
}
let g = new List$1(Tuple$2.$.specialize(Number_$type, Number_$type), 0);
if (e > 0) {
let h = this.cf + this.b4;
let i = this.b3 - this.cg;
let j = 100000;
let k = Math.abs(i - h) / j;
if (e >= k) {
for (let l = h; l <= i || this.bo(l, i, e); l = l + e) {
g.add(new Tuple$2(Number_$type, Number_$type, l, c.i(l)));
}
}
}
if (b.d.length != g.count) {
b.e = new Array(g.count);
b.d = new Array(g.count);
b.f = new Array(g.count);
b.c = new Array(g.count);
b.g = new Array(g.count);
b.h = new Array(g.count);
}
b.n = this.cd;
let m = new FormatLinearGraphLabelEventArgs();
m.actualMinimumValue = this.b4;
m.actualMaximumValue = this.b3;
let n = new AlignLinearGraphLabelEventArgs();
n.actualMinimumValue = this.b4;
n.actualMaximumValue = this.b3;
for (let o = 0; o < g.count; o++) {
let p = g._inner[o].c;
if (this.formatLabel == null) {
p = (Math.round(p * 100) / 100);
}
let q = (p).toString();
if (this.aj != null) {
q = this.aj.i(p);
}
m.value = p;
n.value = p;
m.label = q;
if (this.formatLabel != null && this.bi) {
this.formatLabel(this, m);
}
q = m.label;
n.label = q;
let r = this.view.cr(((() => {
let $ret = new TextBlock();
$ret.al = q;
return $ret;
})()));
n.width = r.width;
n.height = r.height;
if (this.as == 0) {
n.offsetX = -1 * (r.width / 2);
n.offsetY = -1 * (r.height);
}
else {
n.offsetX = -1 * r.width;
n.offsetY = -1 * (r.height / 2);
}
if (this.alignLabel != null && this.bi) {
this.alignLabel(this, n);
}
if (this.bi) {
b.f[o] = n.width;
b.c[o] = n.height;
}
else {
b.f[o] = 0;
b.c[o] = 0;
}
b.g[o] = n.offsetX;
b.h[o] = n.offsetY;
b.d[o] = q;
b.e[o] = g._inner[o].d;
}
}
bo(a, b, c) {
let d = c / 10000;
if (isNaN_(d)) {
d = 1E-05;
}
let e = Math.abs(a - b);
if (e < d) {
return true;
}
return false;
}
f6() {
let a = this.an;
let b = a.a;
b.e = this.im;
b.f = this.io;
b.c = this.b8;
b.a = this.b6;
b.b = this.b7;
}
f8() {
let a = this.de;
if (isNaN_(a)) {
return;
}
let b = !(this.a2 == 0 || this.a2 == 5);
let c = this.an.c;
let d = this.ar;
let e = d.i(a);
this.f9(e, c, b, false);
let f = this.ca;
if (b && !isNaN_(f)) {
this.f9(d.i(f), c, false, true);
}
}
f9(a, b, c, d) {
let e = new LinearGraphNeedleParameters();
e.c = this.ap;
e.e = this.bg;
e.d = this.as;
e.u = this.ct;
e.q = this.cp;
e.v = this.cu;
e.r = this.cq;
e.t = this.cs;
e.p = this.co;
e.s = this.cr;
e.w = this.cv;
e.o = this.cn * 0.5 / this.c0();
let f = new LinearGraphNeedleFrame();
let g = this.is;
let h = this.it;
if (c) {
g = BrushUtil.s(g, this.b2);
h = BrushUtil.s(h, this.b2);
}
f.r = g;
f.s = h;
f.o = this.cw;
let i = new LinearGraphNeedlePreparer();
i.b = e;
i.c(f);
f.l = -90;
f.p = a;
if (d) {
b.af = f;
}
else {
b.ag = f;
}
}
iq(a, b) {
if (b != null && b.count > 0) {
return b.item(a % b.count);
}
else {
return null;
}
}
gl(a) {
let b = this.i4;
let c = a.c;
let d = this.a7;
let e = c.j;
let f = c.w;
let g = c.v;
let h = c.ad;
let i = c.x;
let j = this.a5;
let k = c.i;
let l = c.p;
let m = c.o;
let n = c.ac;
let o = c.q;
d.f = true;
for (let p = 0; p < this.br.count; p++) {
d.n(this.br._inner[p]);
}
this.br.clear();
let q = this.c0();
let r = this.dg();
for (let s = 0; s < e.length; s++) {
let t, u, v, w;
if (this.as == 1) {
t = b.left + q * f;
u = r - e[s];
v = b.left + q * g;
w = u;
}
else {
t = b.left + e[s];
u = q * (1 - f);
v = t;
w = q * (1 - g);
}
let x = d.a();
let y = new PathGeometry();
let z = new PathFigure();
z._startPoint = { $type: Point_$type, x: t, y: u };
z._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: v, y: w };
return $ret;
})()));
y.c.add(z);
x.an = y;
x._stroke = h;
x.ad = i;
this.br.add(x);
}
for (let aa = 0; aa < k.length; aa++) {
let ab, ac, ad, ae;
if (this.as == 1) {
ab = b.left + q * l;
ac = r - k[aa];
ad = b.left + q * m;
ae = ac;
}
else {
ab = k[aa];
ac = q * (1 - l);
ad = ab;
ae = q * (1 - m);
}
let af = d.a();
let ag = new PathGeometry();
let ah = new PathFigure();
ah._startPoint = { $type: Point_$type, x: ab, y: ac };
ah._segments.add(((() => {
let $ret = new LineSegment(1);
$ret.c = { $type: Point_$type, x: ad, y: ae };
return $ret;
})()));
ag.c.add(ah);
af.an = ag;
af._stroke = n;
af.ad = o;
this.br.add(af);
}
d.f = false;
}
gi(a) {
let b = this.i4;
let c = a.c;
let d = c.e;
let e = c.d;
let f = c.g;
let g = c.h;
let h = c.f;
let i = c.c;
let j = c.n;
let k = this.a4;
k.f = true;
for (let l = 0; l < this.bp.count; l++) {
k.n(this.bp._inner[l]);
}
this.bp.clear();
let m = c.ab;
let n = this.df();
let o = this.dg();
for (let p = 0; p < e.length; p++) {
let q, r;
if (this.as == 1) {
q = b.left + n * j;
r = b.top + o - d[p];
}
else {
q = b.left + d[p];
r = b.top + n * (1 - j);
}
let s = k.a();
s.al = e[p];
this.view.bt(s, m);
let t = h[p];
let u = i[p];
let v = f[p];
let w = g[p];
this.view.bk(s, q + v, r + w);
if (this.bi) {
this.view.a4(s);
}
else {
this.view.a5(s);
}
this.bp.add(s);
}
k.f = false;
}
gk(a) {
let b = a.c;
let c = this.a6;
c.f = true;
for (let d = 0; d < this.bq.count; d++) {
c.n(this.bq._inner[d]);
}
this.bq.clear();
let e = this.c0();
let f = this.dg();
let g = this.ix();
let h = this.view.co();
if (isNaN_(b.s) || isNaN_(b.t) || isNaN_(b.u) || isNaN_(b.r)) {
h.an = null;
}
else {
let i = this.c3();
h.an = b.ae(g, e, i, this.as);
h._fill = this.iu;
h._stroke = this.iv;
h.ad = this.c7;
}
for (let j = 0; j < b.m.count; j++) {
let k = b.m._inner[j];
let l = c.a();
l.an = k.k(g, e, f, this.as);
l._fill = k.i;
l._stroke = k.j;
l.ad = k.h;
this.bq.add(l);
}
this.view.bs(this.bq);
c.f = false;
}
gh(a) {
let b = this.i3;
let c = this.view.cl();
let d = a.a;
let e = this.as == 0 ? b.height : b.width;
let f = this.as == 0 ? b.width : b.height;
let g = d.g(e, f, this.as);
c.an = g;
c._fill = d.e;
c._stroke = d.f;
c.ad = d.c;
}
bv(a) {
let b = new List$1(Point_$type, 0);
for (let c = 0; c < a.count; c++) {
b.add({ $type: Point_$type, x: a._inner[c].x, y: a._inner[c].y });
}
return b;
}
gj(a, b, c) {
if (c) {
this.bt = null;
if (this.a2 == 0) {
return;
}
}
else {
this.bu = null;
}
let d = c ? this.view.cm() : this.view.cn();
let e = this.de;
if (isNaN_(e) || e < this.b4 || e > this.b3) {
d.an = null;
return;
}
let f = this.c0();
let g = this.dg();
let h = f;
let i = b.p;
let j = 0;
if (this.as == 1) {
i = this.i4.left;
j = g - b.p;
}
d.an = b.t(h, i, j);
d._fill = b.r;
d._stroke = b.s;
d.ad = b.o;
let k = new PathVisualData(1, "needle", d);
let l = k.getPoints(new GetPointsSettings());
if (l.count > 0) {
let m = this.bv(l._inner[0]);
let n = 1.7976931348623157E+308, o = 1.7976931348623157E+308;
let p = -1.7976931348623157E+308, q = -1.7976931348623157E+308;
for (let r = 0; r < m.count; r++) {
n = m._inner[r].x < n ? m._inner[r].x : n;
o = m._inner[r].y < o ? m._inner[r].y : o;
p = m._inner[r].x > p ? m._inner[r].x : p;
q = m._inner[r].y > q ? m._inner[r].y : q;
}
let s = new Rect(2, { $type: Point_$type, x: n, y: o }, { $type: Point_$type, x: p, y: q });
if (c) {
this.bt = m;
this.iz = s;
}
else {
this.bu = m;
this.i0 = s;
}
}
}
f5(a, b) {
this.bc = true;
this.view.br();
}
fx(a, b) {
this.bc = true;
this.view.br();
}
c0() {
if (this.as == 0) {
return this.bj ? this.i5.height : this.i4.height;
}
return this.bj ? this.i5.width : this.i4.width;
}
c3() {
if (this.as == 0) {
return this.i5.width * (this.c1 - this.c6);
}
return this.i5.height * (this.c1 - this.c6);
}
df() {
if (this.as == 0) {
return this.i5.height;
}
return this.i5.width;
}
dg() {
if (this.as == 0) {
return this.i5.width;
}
return this.i5.height;
}
c5() {
let a = this.c6;
if (this.as == 0) {
if (this.bg) {
a = 1 - this.c1;
}
return this.i5.left + this.i5.width * a;
}
if (this.bg) {
a = 1 - this.c1;
}
return this.i5.top + this.i5.height * a;
}
ix() {
let a = this.i4.left;
if (this.bj) {
a = 0;
}
let b = this.c6;
if (this.as == 0) {
if (this.bg) {
b = 1 - this.c1;
}
return { $type: Point_$type, x: a + this.i4.width * b, y: this.i4.top };
}
if (!this.bg) {
b = 1 - this.c1;
}
return { $type: Point_$type, x: a, y: this.i4.top + this.i4.height * b };
}
f3(a, b, c) {
switch (a) {
case XamLinearGauge.$$p[0]:
case XamLinearGauge.$$p[3]:
case XamLinearGauge.$$p[49]:
case XamLinearGauge.$$p[53]:
case XamLinearGauge.$$p[57]:
case XamLinearGauge.$$p[24]:
case XamLinearGauge.$$p[30]:
case XamLinearGauge.$$p[40]:
this.view.a8(a, b, c);
break;
case XamLinearGauge.$$p[44]:
this.view.bd(b, c);
break;
case XamLinearGauge.$$p[47]:
this.view.be(b, c);
break;
case "PixelScalingRatio":
if (isNaN_(DeviceUtils.a(this.cx))) {
this.b5 = 1;
}
else {
this.b5 = DeviceUtils.a(this.cx);
}
break;
case "ActualPixelScalingRatio":
this.view.bi();
break;
}
switch (a) {
case XamLinearGauge.$$p[15]:
case XamLinearGauge.$$p[16]:
if (this.d4 != null) {
this.aj = new BindingFormatter();
this.aj.j = this.d4;
this.aj.d = this.ag;
}
else {
this.aj = null;
}
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[65]:
if (this.valueChanged != null) {
this.valueChanged(this, new DoubleValueChangedEventArgs(b, c));
}
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[9]:
{
if (this.highlightValueChanged != null) {
this.highlightValueChanged(this, new DoubleValueChangedEventArgs(b, c));
}
let d = this.a0 == 2;
this.gp();
let e = this.a0 == 2;
this.bc = true;
if (!d && e) {
this.a2 = 1;
}
else if (d && !e) {
this.a2 = 4;
}
this.view.br();
break;
}
case XamLinearGauge.$$p[7]:
{
let f = this.a0 == 2;
this.gp();
let g = this.a0 == 2;
this.bc = true;
if (!f && g) {
this.a2 = 1;
}
else if (f && !g) {
this.a2 = 4;
}
this.view.br();
break;
}
case XamLinearGauge.$$p[8]:
this.gq();
break;
case "ActualHighlightValueOpacity":
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[64]:
this.av.r = this.di;
this.view.br();
break;
case "TransitionProgress":
if (this.dd >= 1) {
this.av.w();
let h = this.an;
this.an = this.ao;
this.ao = h;
this.f7();
this.f8();
this.ga();
this.f6();
this.gh(this.an);
this.gk(this.an);
this.gj(this.an, this.an.c.af, true);
this.gj(this.an, this.an.c.ag, false);
this.gl(this.an);
this.gi(this.an);
if (this.a2 == 5) {
this.ft();
this.view.br();
return;
}
else if (this.a2 == 2) {
this.a2 = 3;
}
}
this.am.d(this.dd, this.ao, this.an);
this.gh(this.am);
this.gk(this.am);
this.gj(this.am, this.am.c.af, true);
this.gj(this.am, this.am.c.ag, false);
this.gl(this.am);
this.gi(this.am);
this.view.as();
break;
case XamLinearGauge.$$p[30]:
case XamLinearGauge.$$p[35]:
case XamLinearGauge.$$p[29]:
case XamLinearGauge.$$p[41]:
case XamLinearGauge.$$p[32]:
case XamLinearGauge.$$p[37]:
case XamLinearGauge.$$p[33]:
case XamLinearGauge.$$p[38]:
case XamLinearGauge.$$p[31]:
case XamLinearGauge.$$p[36]:
case XamLinearGauge.$$p[34]:
case XamLinearGauge.$$p[39]:
case XamLinearGauge.$$p[42]:
case XamLinearGauge.$$p[40]:
case XamLinearGauge.$$p[0]:
case XamLinearGauge.$$p[3]:
case XamLinearGauge.$$p[4]:
case XamLinearGauge.$$p[1]:
case XamLinearGauge.$$p[2]:
case XamLinearGauge.$$p[49]:
case XamLinearGauge.$$p[53]:
case XamLinearGauge.$$p[55]:
case XamLinearGauge.$$p[51]:
case XamLinearGauge.$$p[52]:
case XamLinearGauge.$$p[57]:
case XamLinearGauge.$$p[24]:
case XamLinearGauge.$$p[44]:
case XamLinearGauge.$$p[47]:
case XamLinearGauge.$$p[22]:
case XamLinearGauge.$$p[45]:
case XamLinearGauge.$$p[46]:
case XamLinearGauge.$$p[10]:
case XamLinearGauge.$$p[17]:
case XamLinearGauge.$$p[14]:
case XamLinearGauge.$$p[18]:
case XamLinearGauge.$$p[19]:
case XamLinearGauge.$$p[20]:
case XamLinearGauge.$$p[61]:
case XamLinearGauge.$$p[62]:
case XamLinearGauge.$$p[59]:
case XamLinearGauge.$$p[58]:
case XamLinearGauge.$$p[60]:
case XamLinearGauge.$$p[27]:
case XamLinearGauge.$$p[26]:
case XamLinearGauge.$$p[25]:
case XamLinearGauge.$$p[28]:
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[48]:
let i = b;
let j = c;
if (i != null) {
let k = i;
k.collectionChanged = delegateRemove(k.collectionChanged, runOn(this, this.ge));
}
if (j != null) {
let l = j;
l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.ge));
}
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[43]:
case XamLinearGauge.$$p[13]:
case XamLinearGauge.$$p[23]:
case XamLinearGauge.$$p[21]:
case XamLinearGauge.$$p[50]:
case XamLinearGauge.$$p[54]:
this.b4 = Math.min(this.ci, this.ch);
this.b3 = Math.max(this.ci, this.ch);
let m = this.c5();
this.ar = new LinearGraphScaler(this.b4, this.b3, m, m + this.c3(), this.bg);
this.bc = true;
this.view.br();
break;
case XamLinearGauge.$$p[5]:
case XamLinearGauge.$$p[6]:
this.view.b1();
this.bc = true;
this.view.br();
break;
}
this.f4(a);
}
ge(a, b) {
if (b.oldItems != null) {
for (let c of fromEn(b.oldItems)) {
c.propertyChanged = delegateRemove(c.propertyChanged, runOn(this, this.gd));
}
}
if (b.newItems != null) {
for (let d of fromEn(b.newItems)) {
d.propertyChanged = delegateCombine(d.propertyChanged, runOn(this, this.gd));
}
}
this.bc = true;
this.view.br();
}
gd(a, b) {
this.bc = true;
this.view.br();
}
fu(a, b) {
this.bc = true;
this.view.br();
}
refresh() {
this.bc = true;
this.view.br();
}
ay() {
return FontUtil.toFontInfo(this.view.ah, this.dt);
}
get cx() {
return this.b0;
}
set cx(a) {
let b = this.b0;
this.b0 = a;
this.f3("PixelScalingRatio", b, this.b0);
}
get b5() {
return this.bz;
}
set b5(a) {
let b = this.bz;
this.bz = a;
this.f3("ActualPixelScalingRatio", b, this.bz);
}
}
XamLinearGauge.$t = markType(XamLinearGauge, 'XamLinearGauge', Control.$, [INotifyPropertyChanged_$type]);
XamLinearGauge.$$p = markDep(DependencyProperty, PropertyMetadata, XamLinearGauge, 'f3', ['BackingBrush:im:gr', [Brush.$, null], 'BackingInnerExtent:b6:gs', [1, 0], 'BackingOuterExtent:b7:gt', [1, 1], 'BackingOutline:io:gu', [Brush.$, null], 'BackingStrokeThickness:b8:gv', [1, 2], 'FontBrush:ip:gw', [Brush.$, null], 'Font:dt:gx', [2, null], 'HighlightValueDisplayMode:a1:gy', [HighlightedValueDisplayMode_$type, enumGetBox(HighlightedValueDisplayMode_$type, 0)], 'HighlightValueOpacity:cb:gz', [1, 0.5], 'HighlightValue:ca:g0', [1, NaN], 'Interval:cc:g1', [1, NaN], 'IsHighlightNeedleDraggingEnabled:be:g2', [0, false], 'IsNeedleDraggingEnabled:bf:g3', [0, false], 'IsScaleInverted:bg:g4', [0, false], 'LabelExtent:cd:g5', [1, 0], 'LabelFormat:d4:g6', [2, null], 'LabelFormatSpecifiers:ag:g7', [Array_$type, null], 'LabelInterval:ce:g8', [1, NaN], 'LabelsPostInitial:cf:g9', [1, 0], 'LabelsPreTerminal:cg:ha', [1, 0], 'LabelsVisible:bi:hb', [0, true], 'MaximumValue:ch:hc', [1, 100], 'MergeViewports:bj:hd', [0, false], 'MinimumValue:ci:he', [1, 0], 'MinorTickBrush:ir:hf', [Brush.$, null], 'MinorTickCount:cj:hg', [1, 4], 'MinorTickEndExtent:ck:hh', [1, 0.35], 'MinorTickStartExtent:cl:hi', [1, 0.05], 'MinorTickStrokeThickness:cm:hj', [1, 1], 'NeedleBreadth:cn:hk', [1, 6], 'NeedleBrush:is:hl', [Brush.$, null], 'NeedleInnerBaseWidth:co:hm', [1, NaN], 'NeedleInnerExtent:cp:hn', [1, NaN], 'NeedleInnerPointExtent:cq:ho', [1, NaN], 'NeedleInnerPointWidth:cr:hp', [1, NaN], 'NeedleName:ep:hq', [2, null], 'NeedleOuterBaseWidth:cs:hr', [1, NaN], 'NeedleOuterExtent:ct:hs', [1, NaN], 'NeedleOuterPointExtent:cu:ht', [1, NaN], 'NeedleOuterPointWidth:cv:hu', [1, NaN], 'NeedleOutline:it:hv', [Brush.$, null], 'NeedleShape:ap:hw', [LinearGraphNeedleShape_$type, enumGetBox(LinearGraphNeedleShape_$type, 3)], 'NeedleStrokeThickness:cw:hx', [1, 1], 'Orientation:as:hy', [LinearScaleOrientation_$type, enumGetBox(LinearScaleOrientation_$type, 0)], 'RangeBrushes:ah:hz', [BrushCollection.$, null], 'RangeInnerExtent:cy:h0', [1, 0.05], 'RangeOuterExtent:cz:h1', [1, 0.65], 'RangeOutlines:ai:h2', [BrushCollection.$, null], 'Ranges::h3', [LinearGraphRangeCollection.$, null], 'ScaleBrush:iu:h4', [Brush.$, null], 'ScaleEndExtent:c1:h5', [1, 0.95], 'ScaleInnerExtent:c2:h6', [1, 0.05], 'ScaleOuterExtent:c4:h7', [1, 0.65], 'ScaleOutline:iv:h8', [Brush.$, null], 'ScaleStartExtent:c6:h9', [1, 0.05], 'ScaleStrokeThickness:c7:ia', [1, 1], 'ShowToolTipTimeout:dh:ib', [1, 500], 'TickBrush:iw:ic', [Brush.$, null], 'TickEndExtent:c8:id', [1, 0.65], 'TickStartExtent:db:ih', [1, 0.05], 'TickStrokeThickness:dc:ii', [1, 2], 'TicksPostInitial:c9:ie', [1, 0], 'TicksPreTerminal:da:ig', [1, 0], 'ToolTip::ij', [4, null], 'TransitionDuration:di:ik', [1, 0], 'Value:de:il', [1, NaN]]);
return XamLinearGauge;
})();
/**
* @hidden
*/
export let XamLinearGaugeView = /*@__PURE__*/ (() => {
class XamLinearGaugeView extends Base {
constructor(a) {
super();
this.ap = 0;
this.ao = 0;
this.m = null;
this.i = null;
this.aj = null;
this.p = null;
this.ah = null;
this.aa = null;
this.z = null;
this.y = null;
this.ab = null;
this.cj = null;
this.ci = null;
this.ck = null;
this.ch = null;
this.ca = null;
this.cb = null;
this.b7 = null;
this.b8 = null;
this.cc = null;
this.cd = null;
this.ce = null;
this.b9 = null;
this.c = null;
this.d = null;
this.e = null;
this.f = null;
this.q = false;
this.v = null;
this.a = ["needle", "backing", "scale", "tick", "minortick", "label"];
this.u = false;
this.t = false;
this.ai = null;
this.k = null;
this.ak = 0;
this.am = 0;
this.aq = null;
this.an = -1;
this.cf = null;
this.al = 0;
this.x = null;
this.b6 = ((() => {
let $ret = new Brush();
$ret.fill = "black";
return $ret;
})());
this.r = false;
this.n = null;
this.b5 = null;
this.ac = 0;
this.ad = 1;
this.m = a;
this.v = new Dictionary$2(String_$type, Dictionary$2.$.specialize(String_$type, Brush.$), 0);
this.cj = new Path();
this.ci = new Path();
this.ck = new Path();
this.ch = new Path();
this.aa = new List$1(Path.$, 0);
this.z = new List$1(Path.$, 0);
this.y = new List$1(TextBlock.$, 0);
this.ab = new List$1(TextBlock.$, 0);
}
a3() {
let a = CanvasScalingHelpers.b(this.ah);
this.m.b5 = CanvasScalingHelpers.a(this.m.cx, this.m.b5, a);
if (this.i != null) {
CanvasScalingHelpers.h(this.i, a);
}
}
bc() {
this.k = new LinearGraphTooltipDataContext();
this.al = this.m.dh;
this.a3();
}
s() {
return true;
}
cn() {
return this.cj;
}
cm() {
return this.ci;
}
co() {
return this.ck;
}
cl() {
return this.ch;
}
a1() {
this.q = true;
let a = ["#778899", "#EBEDEF", "#e0e0e0", "#617583", "rgba(100,107,114,.74)", "rgba(100,107,114,.74)"];
let b = ["#778899", "#B2B9C0", "#e0e0e0", null, null, null];
let c = ((() => {
let $ret = new List$1(Array_$type, 0);
$ret.add(a);
$ret.add(b);
return $ret;
})());
this.v.clear();
let d = this.a.length;
for (let e = 0; e < d; e++) {
let f = this.a[e];
let g = "ui-lineargauge-" + f;
let h = "ui-lineargauge-" + f + "-fill";
let i = "ui-lineargauge-" + f + "-outline";
let j;
if (!((() => { let k = XamLinearGaugeView.w.tryGetValue(h, j); j = k.p1; return k.ret; })())) {
j = BrushUtil.m(h, g, "background-color", this.ah, a[e]);
XamLinearGaugeView.w.addItem(h, j);
}
let k;
if (!((() => { let l = XamLinearGaugeView.w.tryGetValue(i, k); k = l.p1; return l.ret; })())) {
k = BrushUtil.m(i, g, "border-top-color", this.ah, b[e]);
XamLinearGaugeView.w.addItem(i, k);
}
let l = new Dictionary$2(String_$type, Brush.$, 0);
l.item("fill", j);
l.item("outline", k);
this.v.item(this.a[e], l);
}
this.b0();
if (XamLinearGaugeView.g == null || XamLinearGaugeView.h == null) {
let m = BrushUtil.i("ui-lineargauge-range-fill-palette-", "ui-lineargauge-range-outline-palette-", "ui-lineargauge-range-palette-", this.ah, XamLinearGaugeView.g, XamLinearGaugeView.h, ["#216E99", "#216E99", "#44acd6", "#44acd6", "#cecece", "#cecece"]);
XamLinearGaugeView.g = m.p4;
XamLinearGaugeView.h = m.p5;
}
this.c = XamLinearGaugeView.g;
this.d = XamLinearGaugeView.h;
if (this.e == null) {
this.m.ah = this.c;
}
if (this.f == null) {
this.m.ai = this.d;
}
this.q = false;
}
b0() {
this.q = true;
let a = this.a.length;
for (let b = 0; b < a; b++) {
let c = this.a[b];
this.bz(c, this.v.item(c));
}
this.q = false;
}
bz(a, b) {
let c = b.item("fill");
let d = b.item("outline");
switch (a) {
case "needle":
if (this.ca == null) {
this.m.is = c;
}
if (this.cb == null) {
this.m.it = d;
}
break;
case "scale":
if (this.cc == null) {
this.m.iu = c;
}
if (this.cd == null) {
this.m.iv = d;
}
break;
case "backing":
if (this.b7 == null) {
this.m.im = c;
}
if (this.b8 == null) {
this.m.io = d;
}
break;
case "tick":
if (this.ce == null) {
this.m.iw = c;
}
break;
case "minortick":
if (this.b9 == null) {
this.m.ir = c;
}
break;
case "label":
this.b6 = c;
break;
}
}
a8(a, b, c) {
let d = b;
let e = c;
if (!this.q) {
switch (a) {
case XamLinearGauge.$$p[30]:
this.ca = e;
break;
case XamLinearGauge.$$p[40]:
this.cb = e;
break;
case XamLinearGauge.$$p[0]:
this.b7 = e;
break;
case XamLinearGauge.$$p[3]:
this.b8 = e;
break;
case XamLinearGauge.$$p[49]:
this.cc = e;
break;
case XamLinearGauge.$$p[53]:
this.cd = e;
break;
case XamLinearGauge.$$p[57]:
this.ce = e;
break;
case XamLinearGauge.$$p[24]:
this.b9 = e;
break;
}
if (e == null) {
this.b0();
}
}
}
bd(a, b) {
if (!this.q) {
this.e = b;
if (this.e == null) {
this.m.ah = this.c;
}
}
}
be(a, b) {
if (!this.q) {
this.f = b;
if (this.f == null) {
this.m.ai = this.d;
}
}
}
b(a, b) {
this.ah.startCSSQuery();
for (let c = 0; c < b.length; c++) {
b[c] = this.ah.getCssDefaultPropertyValue(a, b[c]);
}
this.ah.endCSSQuery();
return b;
}
bv() {
this.a1();
this.b1();
this.br();
}
cg(a) {
let b = CanvasGestureDOMEventProxy.c5(this.ah.rootWrapper);
return { $type: Point_$type, x: a.x - b.left, y: a.y - b.top };
}
bu(a, b, c, d) {
this.cf = a;
this.an = c;
this.aq = d;
this.bq();
if (this.ah != null) {
this.am = this.ah.setTimeout(runOn(this, this.b2), this.al);
}
else {
this.am = window.setTimeout(runOn(this, this.b2), this.al);
}
this.t = true;
}
a2() {
if (this.t) {
if (this.ah != null) {
this.ah.clearTimeout(this.am);
}
else {
window.clearTimeout(this.am);
}
this.t = false;
}
if (this.u) {
let a = this.m.toolTip;
if (this.ah != null) {
this.ah.clearTimeout(this.ak);
}
else {
window.clearTimeout(this.ak);
}
a.hide();
this.u = false;
this.k = null;
}
this.al = this.m.dh;
}
bq() {
if (this.t) {
if (this.ah != null) {
this.ah.clearTimeout(this.am);
}
else {
window.clearTimeout(this.am);
}
}
if (this.u) {
let a = this.m.toolTip;
if (this.ah != null) {
this.ah.clearTimeout(this.ak);
}
else {
window.clearTimeout(this.ak);
}
a.hide();
this.u = false;
this.al = intDivide(this.m.dh, 2);
}
}
b2() {
if (this.t) {
if (this.ah != null) {
this.ah.clearTimeout(this.am);
}
else {
window.clearTimeout(this.am);
}
this.t = false;
}
let a = this.an;
let b = this.aq;
let c = this.cf;
if (this.ah != null) {
this.ak = this.ah.setTimeout(runOn(this, this.a2), 10 * this.m.dh);
}
else {
this.ak = window.setTimeout(runOn(this, this.a2), 10 * this.m.dh);
}
let d = this.m.ranges._inner[a];
if (this.ai != this.m.toolTip) {
if (this.ai != null) {
this.ai.remove();
}
this.ai = this.m.toolTip;
this.ai.setStyleProperty("z-index", "10000");
this.ai.setStyleProperty("position", "absolute");
this.ah.append(this.ai);
}
this.k = this.j(b, a);
let context_ = this.k;
let tooltip_ = this.ai;
let tooltipType_ = b;
if (tooltip_.updateToolTip) {
tooltip_.updateToolTip(context_, tooltipType_);
}
;
let e = this.ai.findByClass(".ui-tooltip-container");
if (e != null && e.length > 0) {
e[0].setAttribute("style", null);
}
let f = "ui-simple-default-tooltip-content";
let g = this.ai.findByClass("." + f);
if (g != null && g.length > 0) {
let h = ["border-top-color", "border-top-width", "border-top-style", "border-top-left-radius", "background-color", "padding-top", "font-weight"];
let i = ["border-color", "border-width", "border-style", "border-radius", "background-color", "padding", "font-weight"];
let j = ((() => {
let $ret = new List$1(String_$type, 0);
$ret.add(this.k.brush.color.colorString);
$ret.add("2px");
$ret.add("solid");
$ret.add("4px");
$ret.add("rgba(230, 230, 230, 0.74)");
$ret.add("4px");
$ret.add("bold");
return $ret;
})());
let k = new Dictionary$2(String_$type, String_$type, 0);
let l = new Array(h.length);
arrayCopy1(h, 0, l, 0, h.length);
this.b(f, l);
for (let m = 0; m < l.length; m++) {
this.ai.setStyleProperty(i[m], (l[m] == null) ? j._inner[m] : l[m]);
}
}
this.ai.setStyleProperty("top", (c.y + 15).toString() + "px").setStyleProperty("left", (c.x + 15).toString() + "px");
this.ai.show();
this.u = true;
}
j(a, b) {
let c = new LinearGraphTooltipDataContext();
switch (a) {
case "range":
let d = this.m.ranges._inner[b];
c.item = d;
c.itemName = d.u;
c.label = d.u + ": " + d.o.toString() + "-" + d.j.toString();
let e = d.an;
let f = d.ao;
c.brush = e != null ? e : this.m.iq(b, this.c);
c.outline = f != null ? f : this.m.iq(b, this.d);
c.thickness = d.p;
break;
case "needle":
c.item = this.m.de;
c.itemName = this.m.ep;
c.label = this.m.ep != null ? this.m.ep + ": " + this.m.de.toString() : this.m.de.toString();
c.brush = this.m.is;
c.outline = this.m.it;
c.thickness = this.m.cw;
break;
}
return c;
}
a9(a) {
if (a == null) {
this.aj = null;
this.ah = null;
this.ai = null;
this.p = null;
if (this.m.a9) {
this.m.av.w();
}
this.at();
return;
}
let b = a;
this.ah = b;
this.m.av.u(this.ah);
this.ah.rootWrapper.addClass("ui-lineargauge-container");
this.ad = (isNaN_(this.m.cx) ? this.m.b5 : this.m.cx);
let c = this.ad;
let d = Math.round(b.rootWrapper.width());
let e = Math.round(b.rootWrapper.height());
let f = d * c;
let g = e * c;
this.ah.rootWrapper.setStyleProperty("position", "relative");
let h = this.ah.createElement("canvas");
h.setStyleProperty("position", "absolute");
this.ah.append(h);
this.ap = f;
this.ao = g;
h.setAttribute("width", f.toString());
h.setAttribute("height", g.toString());
h.setStyleProperty("width", d.toString() + "px");
h.setStyleProperty("height", e.toString() + "px");
h.setStyleProperty("left", "0px");
h.setStyleProperty("top", "0px");
this.m.i5 = new Rect(0, 0, 0, d, e);
this.m.i3 = new Rect(0, 0, 0, d, e);
this.aj = h;
let i = this.ah.get2DCanvasContext(this.aj);
this.p = new RenderingContext(new CanvasViewRenderer(), i);
this.a1();
this.b1();
this.p.af(this.n);
this.at();
if (TypeRegistrar.isRegistered("CanvasGestureDOMEventProxy")) {
this.i = typeCast(EventProxy.$, TypeRegistrar.create("CanvasGestureDOMEventProxy", this.ah.rootWrapper, this.ah, false));
}
if (this.i != null) {
let j = this.i;
j.onMouseOver = delegateCombine(j.onMouseOver, runOn(this, this.ay));
let k = this.i;
k.onMouseLeave = delegateCombine(k.onMouseLeave, runOn(this, this.ax));
let l = this.i;
l.onContactStarted = delegateCombine(l.onContactStarted, runOn(this, this.aw));
let m = this.i;
m.onContactMoved = delegateCombine(m.onContactMoved, runOn(this, this.av));
let n = this.i;
n.onContactCompleted = delegateCombine(n.onContactCompleted, runOn(this, this.au));
}
this.bp();
}
au(a, b) {
if (this.m != null) {
this.m.onMouseUp(a);
}
}
av(a, b) {
if (this.m != null) {
this.m.onMouseMove(a, b);
}
}
aw(a, b) {
if (this.m != null) {
this.m.onMouseDown(a, b);
}
}
ay(a, b, c) {
if (this.m != null) {
this.m.onMouseOver(a, b, c);
}
}
ax(a) {
if (this.m != null) {
this.m.onMouseLeave();
}
}
at() {
if (this.i != null) {
let a = this.i;
a.onMouseOver = delegateRemove(a.onMouseOver, runOn(this, this.ay));
let b = this.i;
b.onMouseLeave = delegateRemove(b.onMouseLeave, runOn(this, this.ax));
let c = this.i;
c.onContactStarted = delegateRemove(c.onContactStarted, runOn(this, this.aw));
let d = this.i;
d.onContactMoved = delegateRemove(d.onContactMoved, runOn(this, this.av));
let e = this.i;
e.onContactCompleted = delegateRemove(e.onContactCompleted, runOn(this, this.au));
this.i.aw();
}
}
ba() {
this.a3();
let a = Math.round(this.ah.rootWrapper.width());
let b = Math.round(this.ah.rootWrapper.height());
this.m.i5 = new Rect(0, 0, 0, a, b);
this.m.i3 = new Rect(0, 0, 0, a, b);
if (this.i != null) {
this.i.bm = this.m.i5;
}
}
as() {
this.bp();
}
bs(a) {
this.x = a;
}
bp() {
let a = this.m.i5.width;
let b = this.m.i5.height;
let c = a * this.ad;
let d = b * this.ad;
if (this.ap != a || this.ao != b) {
this.aj.setAttribute("width", c.toString());
this.aj.setAttribute("height", d.toString());
this.aj.setStyleProperty("width", a.toString() + "px");
this.aj.setStyleProperty("height", b.toString() + "px");
this.ap = truncate(Math.round(c));
this.ao = truncate(Math.round(d));
}
if (this.p.d && this.ad != 1) {
this.p.aa();
this.p.ab(this.ad, this.ad);
}
this.p.l(this.m.i5.left, this.m.i5.top, this.m.i5.width, this.m.i5.height);
this.p.t(this.ch);
this.p.t(this.ck);
if (this.x != null) {
for (let e = 0; e < this.x.count; e++) {
this.p.t(this.x._inner[e]);
}
}
for (let f = 0; f < this.y.count; f++) {
this.p.af(this.n);
this.p.x(this.y._inner[f]);
}
for (let g = 0; g < this.z.count; g++) {
this.p.t(this.z._inner[g]);
}
this.p.t(this.cj);
this.p.t(this.ci);
if (this.p.d && this.ad != 1) {
this.p.z();
}
}
b1() {
if (this.m.dt != null) {
this.n = this.m.ay();
}
else {
this.n = FontUtil.getFont(this.ah);
}
this.ac = this.ae(this.n);
if (this.m.ip == null) {
let a = this.ah.rootWrapper.getStyleProperty("color");
if (stringIsNullOrEmpty(a) == false) {
this.b5 = new Brush();
this.b5._fill = a;
this.m.ip = this.b5;
}
}
if (this.p != null) {
this.p.af(this.n);
}
}
af(a) {
let b = typeCast(TextBlock.$, a);
if (b != null && b.al != null) {
return this.p.f(b) + 0;
}
return 0;
}
cr(a) {
if (isNaN_(this.ac)) {
this.ac = this.ae(null);
}
let b = this.af(a);
let c = this.ac;
return new Size(1, b, c);
}
bt(a, b) {
if (b != null) {
a.ao = b;
}
else {
a.ao = this.b6;
}
}
bk(a, b, c) {
a.n = b;
a.o = c;
}
bj(a, b) {
}
bl(a, b) {
}
ae(a) {
return FontUtil.getCurrentFontHeight(this.ah, a);
}
br() {
if (!this.r) {
this.r = true;
window.setTimeout(runOn(this, this.ar), 0);
}
}
ar() {
if (this.r) {
this.r = false;
this.m.fo();
}
}
flush() {
if (this.r) {
this.ar();
}
}
o(a, b) {
return FontUtil.getFontInfo(this.ah, a, b);
}
az(a) {
a.scalePath = new PathVisualData(1, "Scale", this.ck);
a.needlePath = new PathVisualData(1, "Needle", this.cj);
a.highlightNeedlePath = new PathVisualData(1, "HighlightNeedle", this.ci);
a.backingPath = new PathVisualData(1, "Backing", this.ch);
let b = this.n;
for (let c of fromEnum(this.y)) {
if (c._visibility == 0) {
let d = this.o(c, b);
let e = new LinearGraphScaleLabelVisualData();
e.labelValue = c.al;
e.labelPosition = PointData.b({ $type: Point_$type, x: c.n, y: c.o });
e.labelSize = SizeData.b(this.cr(c));
e.appearance = AppearanceHelper.c(c, d);
a.scaleLabels.add(e);
}
}
for (let f of fromEnum(this.z)) {
if (f._visibility == 0) {
let g = new LinearGraphScaleTickmarkVisualData();
g.tickPath = new PathVisualData(1, "tickmarks", f);
a.scaleTickmarks.add(g);
}
}
for (let h of fromEnum(this.x)) {
if (h._visibility == 0) {
let i = new LinearGraphRangeVisualData();
let j = new PathVisualData(1, "range", h);
i.rangePath = j;
a.ranges.add(i);
}
}
}
a7() {
this.a3();
if (this.i != null) {
this.i.au(this.ah.rootWrapper, "");
}
}
bb() {
if (this.i != null && this.ah != null) {
this.i.bi(this.ah.rootWrapper, "");
}
}
bm(a) {
a._visibility = 0;
}
bn(a) {
a._visibility = 1;
}
bo(a) {
this.aa.remove(a);
}
cq() {
let a = new Path();
this.aa.add(a);
return a;
}
bw(a) {
a._visibility = 0;
}
bx(a) {
a._visibility = 1;
}
by(a) {
this.ab.remove(a);
}
b4() {
let a = new TextBlock();
this.ab.add(a);
return a;
}
bf(a) {
a._visibility = 0;
}
bg(a) {
a._visibility = 1;
}
bh(a) {
this.z.remove(a);
}
cp() {
let a = new Path();
this.z.add(a);
return a;
}
a4(a) {
a._visibility = 0;
}
a5(a) {
a._visibility = 1;
}
a6(a) {
this.y.remove(a);
}
b3() {
let a = new TextBlock();
this.y.add(a);
return a;
}
l() {
if (this.k == null) {
return null;
}
return ((() => {
let $ret = new ToolTipInfo();
$ret.b = this.an;
$ret.d = this.cf;
$ret.c = this.aq;
$ret.a = this.k;
return $ret;
})());
}
bi() {
this.ad = this.m.b5;
}
}
XamLinearGaugeView.$t = markType(XamLinearGaugeView, 'XamLinearGaugeView');
XamLinearGaugeView.w = new Dictionary$2(String_$type, Brush.$, 0);
XamLinearGaugeView.g = null;
XamLinearGaugeView.h = null;
return XamLinearGaugeView;
})();