igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,474 lines (1,473 loc) • 45.2 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 { __extends, __values } from "tslib";
import { Base, Point_$type, runOn, fromEnum, markType, PointUtil } from "igniteui-react-core";
import { ISeriesViewerInteractionManager_$type } from "./ISeriesViewerInteractionManager";
import { SeriesHighlightingManager } from "./SeriesHighlightingManager";
import { SeriesSelectionHighlightingManager } from "./SeriesSelectionHighlightingManager";
import { SeriesFocusHighlightingManager } from "./SeriesFocusHighlightingManager";
import { SeriesViewerScrollbarManager } from "./SeriesViewerScrollbarManager";
import { Rect } from "igniteui-react-core";
import { TileZoomManager } from "./TileZoomManager";
import { ChartSelection } from "./ChartSelection";
import { ViewportUtils } from "./ViewportUtils";
import { Size } from "igniteui-react-core";
import { MathUtil } from "igniteui-react-core";
import { MouseEventArgs } from "igniteui-react-core";
import { MouseButtonEventArgs } from "igniteui-react-core";
import { truncate, intDivide, isNaN_ } from "igniteui-react-core";
/**
* @hidden
*/
var SeriesViewerInteractionManager = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SeriesViewerInteractionManager, _super);
function SeriesViewerInteractionManager() {
var _this = _super.call(this) || this;
_this.v = 0;
_this.w = 0;
_this.ao = null;
_this.s = 0;
_this.t = 0;
_this.r = 0;
_this.u = 0;
_this.k = false;
_this.ap = null;
_this.ar = null;
_this.l = false;
_this.n = false;
_this.h = null;
_this.e = null;
_this.f = null;
_this.d = null;
_this.g = null;
_this.aq = null;
_this.as = null;
_this.c = null;
_this.a = null;
_this.j = false;
_this.aq = Rect.empty;
_this.ap = Rect.empty;
return _this;
}
Object.defineProperty(SeriesViewerInteractionManager.prototype, "f$e", {
get: function () {
if (this.e == null) {
this.e = new SeriesHighlightingManager();
}
return this.e;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SeriesViewerInteractionManager.prototype, "f$f", {
get: function () {
if (this.f == null) {
this.f = new SeriesSelectionHighlightingManager();
}
return this.f;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SeriesViewerInteractionManager.prototype, "f$d", {
get: function () {
if (this.d == null) {
this.d = new SeriesFocusHighlightingManager();
}
return this.d;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SeriesViewerInteractionManager.prototype, "f$b", {
get: function () {
if (this.g == null) {
this.g = new SeriesViewerScrollbarManager();
}
return this.g;
},
enumerable: false,
configurable: true
});
SeriesViewerInteractionManager.prototype.f$j = function (a, b, c) {
var d = a.dc;
if (a.bo != null) {
a = a.bo;
}
if (a.bl != null) {
a = a.bl;
}
var e = ((function () {
var $ret = new ChartSelection();
$ret.item = b;
$ret.series = a;
return $ret;
})());
var f = a.dc.selectedSeriesItems;
if (f.contains(e)) {
return;
}
a.dc.selectedSeriesItems.add(e);
};
SeriesViewerInteractionManager.prototype.f$aq = function (a, b, c) {
var d = a.dc;
if (a.bo != null) {
a = a.bo;
}
if (a.bl != null) {
a = a.bl;
}
var e = ((function () {
var $ret = new ChartSelection();
$ret.item = b;
$ret.series = a;
return $ret;
})());
var f = a.dc.selectedSeriesItems;
if (!f.contains(e)) {
return;
}
a.dc.selectedSeriesItems.remove(e);
};
SeriesViewerInteractionManager.prototype.f$as = function (a, b) {
var c = null;
var d = null;
var e = null;
e = a.dc.e();
var f;
var g = ((function () { var h = a.dc.f(b, false, f, false); f = h.p2; return h.ret; })());
if (g != e) {
if (e != null && e.ba.a$e) {
e.ba.a$af(e, b, null, null, false);
}
}
c = f;
if (a != null) {
a.r1(b);
}
if (g != null && !g.ba.a$e) {
g.ba.a$ae(g, b, c, d, false);
}
};
SeriesViewerInteractionManager.prototype.f$a = function (a) {
if (a.av != 0) {
return a.av;
}
var b = 1;
var c = false;
var d = false;
for (var e = 0; e < a.series.count; e++) {
var f = a.series._inner[e];
if (f.isStacked) {
f.p5(function (g) {
if (g.b2 == 2) {
c = true;
}
if (g.b2 == 1) {
d = true;
}
return true;
});
}
else {
if (f.b2 == 2) {
c = true;
}
if (f.b2 == 1) {
d = true;
}
}
}
if (d) {
b = 1;
}
if (c) {
b = 2;
}
if (c && d) {
b = 3;
}
return b;
};
SeriesViewerInteractionManager.prototype.f$ar = function (a) {
var b = a.wk;
var c = b;
var d = a.dc;
var e = a.el();
var f = a.eo;
var g = a.f2;
var h = a.ge;
if (!e) {
c = { $type: Point_$type, x: NaN, y: NaN };
}
if (c.x < 0 || c.x > 1 || c.y < 0 || c.y > 1) {
c = { $type: Point_$type, x: NaN, y: NaN };
}
for (var i = 0; i < a.series.count; i++) {
var j = a.series._inner[i];
j.qe(c);
}
a.os(c);
var k = a.c3 == 0 && !a.e8 && (a.eu || f) && !g && !h;
var l = a.xb;
var m = a.wx;
if (k && !isNaN_(b.x) && !l.isEmpty) {
var n = ViewportUtils.e(b.x, a.wt, l, m);
d.eo(n, l.top, n, l.bottom);
d.ed();
d.ei(n);
}
else {
d.cl();
}
if (k && !isNaN_(b.y) && !l.isEmpty) {
var o = ViewportUtils.i(b.y, a.wt, l, m);
d.eh(l.left, o, l.right, o);
d.d9();
}
else {
d.cg();
}
};
SeriesViewerInteractionManager.prototype.f$aj = function (a) {
switch (a.c3) {
case 0:
a.dc.d5();
this.f$ar(a);
a.dc.cd();
break;
case 1:
a.dc.d7();
a.dc.ck();
this.f$ar(a);
a.dc.cc();
break;
case 2:
a.dc.d7();
a.dc.ck();
this.f$ar(a);
a.dc.ce();
break;
}
};
SeriesViewerInteractionManager.prototype.f$t = function (a, b) {
if (b.x >= 0 && b.y >= 0 && b.x <= a.xb.width && b.y <= a.xb.height) {
this.ak(a, b);
}
else {
a.oe();
}
};
SeriesViewerInteractionManager.prototype.ak = function (a, b) {
var e_1, _a;
var c = a.dc;
var d = a.xb;
if (a.e9 || a.e8) {
return;
}
if (a.eo && a.eu) {
var e = d.height > d.width;
c.bv(e);
try {
for (var _b = __values(fromEnum(a.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
var f = _c.value;
if (f.isStacked) {
f.p5(function (g) {
if (g._visibility == 0) {
g.r9(b, runOn(c, c.bm));
}
if (g.ei) {
g.p3(function (h) {
if (h._visibility == 0) {
h.r9(b, runOn(c, c.bm));
}
return true;
});
}
return true;
});
}
else if (f.ei) {
if (f._visibility == 0) {
if (f._visibility == 0) {
f.r9(b, runOn(c, c.bm));
}
}
f.p3(function (g) {
if (g._visibility == 0) {
g.r9(b, runOn(c, c.bm));
}
return true;
});
}
else {
if (f._visibility == 0) {
f.r9(b, runOn(c, c.bm));
}
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
c.ea();
}
};
SeriesViewerInteractionManager.prototype.aj = function (a, b) {
if (a.eu || a.e6) {
a.eo = true;
a.qs();
this.ap = new Rect(0, b.x, b.y, 0, 0);
this.ar = new Rect(0, b.x, b.y, 0, 0);
a.c3 = 0;
a.nz(a.wn(b));
}
};
SeriesViewerInteractionManager.prototype.f$ah = function (a, b) {
this.aj(a, b);
this.ak(a, b);
this.f$ar(a);
};
SeriesViewerInteractionManager.prototype.f$u = function (a, b, c) {
if (!a.eo) {
this.am(a, b, c);
}
};
SeriesViewerInteractionManager.prototype.f$s = function (a, b) {
this.aq = Rect.empty;
a.oe();
};
SeriesViewerInteractionManager.prototype.f$ao = function (a, b) {
if (this.l) {
this.f$b.onScrollbarDragCancel();
this.l = false;
}
var c = a.dc;
this.u = 1;
this.ae(a);
a.c3 = 0;
this.k = true;
a.f2 = true;
a.qt(true, b);
};
SeriesViewerInteractionManager.prototype.ae = function (a) {
var b = a.dc;
a.eo = false;
b.cj();
b.cf();
b.ch();
a.nz({ $type: Point_$type, x: NaN, y: NaN });
b.cg();
b.cl();
b.ck();
};
SeriesViewerInteractionManager.prototype.f$ag = function (a, b) {
this.f$ao(a, b);
};
SeriesViewerInteractionManager.prototype.f$ap = function (a, b, c, d, e) {
this.v = b.x;
this.w = b.y;
this.s = c;
this.t = d;
this.r = e;
this.ao = a.wt;
this.f$ao(a, b);
};
SeriesViewerInteractionManager.prototype.f$af = function (a, b) {
var c = a.dc;
c.cg();
c.cl();
if (c.av) {
this.aa(a, b);
}
else {
this.ac(a, b);
this.u = b;
}
};
SeriesViewerInteractionManager.prototype.f$al = function (a, b, c, d, e) {
var f = a.dc;
f.cg();
f.cl();
this.s = this.s * c;
this.t = this.t * d;
this.r = this.r * e;
if (a.ff) {
this.s = this.r;
this.t = this.r;
}
var g = a.wt;
var h = a.xb;
var i = b.x - this.v;
var j = b.y - this.w;
this.v = b.x;
this.w = b.y;
var k = g.width;
var l = g.height;
var m = this.ao.width / this.s;
var n = this.ao.height / this.t;
if (m > 1) {
m = 1;
}
if (n > 1) {
n = 1;
}
var o = { $type: Point_$type, x: b.x, y: b.y };
var p = { $type: Point_$type, x: (o.x - h.left) / h.width * g.width + g.left, y: (o.y - h.top) / h.height * g.height + g.top };
var q = new Rect(0, g.left, g.top, m, n);
var r = { $type: Point_$type, x: (p.x - q.left) / q.width * h.width + h.left, y: (p.y - q.top) / q.height * h.height + h.top };
var s = (r.x - o.x) - i;
var t = (r.y - o.y) - j;
var u = s / h.width * q.width;
var v = t / h.height * q.height;
q = new Rect(0, q.left + u, q.top + v, q.width, q.height);
g = q;
a.sh(g, true);
};
SeriesViewerInteractionManager.prototype.f$ac = function (a, b) {
this.ap = new Rect(0, b.x, b.y, 0, 0);
this.ar = new Rect(0, b.x, b.y, 0, 0);
};
SeriesViewerInteractionManager.prototype.ab = function (a, b, c) {
var d = a.wt.width;
var e = a.wt.height;
var f = a.wt.left + d / 2;
var g = a.wt.top + e / 2;
d = d / b;
e = e / b;
var h = f - d / 2;
var i = g - e / 2;
a.sh(new Rect(0, h, i, d, e), true);
};
SeriesViewerInteractionManager.prototype.f$ae = function (a, b) {
var c = a.dc;
if (c.av) {
this.aa(a, b);
}
else {
this.ac(a, b);
}
this.ap = Rect.empty;
a.f2 = false;
};
SeriesViewerInteractionManager.prototype.f$v = function (a, b) {
a.f2 = false;
this.ap = Rect.empty;
a.oe();
};
SeriesViewerInteractionManager.prototype.f$ab = function (a, b) {
a.ns();
};
SeriesViewerInteractionManager.prototype.f$ak = function (a, b, c, d, e) {
a.f2 = false;
this.ap = Rect.empty;
a.oe();
};
SeriesViewerInteractionManager.prototype.aa = function (a, b) {
var c = a.xc;
var d = 1 / b;
var e = { $type: Point_$type, x: c.x + c.width / 2, y: c.y + c.height / 2 };
var f = { $type: Point_$type, x: c.x - e.x, y: c.y - e.y };
var g = new Rect(0, f.x * d + e.x, f.y * d + e.y, c.width * d, c.height * d);
a.sh(g, true);
};
SeriesViewerInteractionManager.prototype.ac = function (a, b) {
var c = a.xb;
var d = a.xc;
var e = b - this.u;
if (e != 0) {
var f = 0.03;
var g = e < 0 ? 1 + f : 1 - f;
var h = { $type: Point_$type, x: d.x + d.width / 2, y: d.y + d.height / 2 };
var i = { $type: Point_$type, x: d.x - h.x, y: d.y - h.y };
var j = new Rect(0, i.x * g + h.x, i.y * g + h.y, d.width * g, d.height * g);
a.sh(j, true);
}
};
SeriesViewerInteractionManager.prototype.f$q = function (a, b, c) {
if (!a.f2) {
this.k = false;
}
var d = false;
if (a.ep) {
if (this.f$b.shouldHandleInteraction(b, c)) {
this.l = true;
d = true;
this.ae(a);
a.dc.dr();
return;
}
}
this.am(a, b, c);
a.p6(b, c);
};
SeriesViewerInteractionManager.prototype.am = function (a, b, c) {
var d;
var e = a.dc;
if (a.c0 != 0) {
d = a.c0;
}
else if (e.ez == 0) {
var f = a.c1(c);
switch (f) {
case 1:
d = a.fo() ? f : 0;
break;
default:
d = f;
break;
}
}
else {
if (e.ez == a.vq) {
d = 1;
}
else if (e.ez == a.vr) {
d = 2;
}
else if (e.ez == a.vs) {
d = 3;
}
else {
d = 0;
}
}
switch (d) {
case 1:
case 2:
case 3:
a.dc.ca();
a.dc.dr();
break;
}
a.c3 = d;
switch (a.c3) {
case 1:
this.ap = new Rect(0, b.x, b.y, 0, 0);
this.ar = new Rect(0, b.x, b.y, 0, 0);
this.aq = new Rect(0, b.x, b.y, 0, 0);
e.d8();
e.eg(this.ap);
a.qy(Rect.empty, true);
break;
case 2:
this.ap = new Rect(0, b.x, b.y, 0, 0);
this.aq = new Rect(0, b.x, b.y, 0, 0);
break;
case 3:
this.ap = new Rect(0, b.x, b.y, 0, 0);
this.ar = new Rect(0, b.x, b.y, 0, 0);
this.aq = new Rect(0, b.x, b.y, 0, 0);
e.d8();
e.eg(this.ap);
a.qy(Rect.empty, true);
break;
}
this.as = a.wt;
a.xd = a.wt;
};
SeriesViewerInteractionManager.prototype.f$an = function (a) {
a.r2();
a.dc.dl();
};
SeriesViewerInteractionManager.prototype.f$am = function (a) {
a.n3();
a.dc.dk();
};
SeriesViewerInteractionManager.prototype.f$at = function (a) {
if (a.ek && !this.n) {
this.n = true;
this.al(a);
}
};
SeriesViewerInteractionManager.prototype.f$n = function (a) {
if (this.n) {
this.ad(a);
this.n = false;
}
};
SeriesViewerInteractionManager.prototype.f$k = function (a) {
if (this.h == null) {
return;
}
this.i.ab();
};
Object.defineProperty(SeriesViewerInteractionManager.prototype, "i", {
get: function () {
return this.h;
},
enumerable: false,
configurable: true
});
SeriesViewerInteractionManager.prototype.al = function (a) {
if (this.h == null) {
this.h = new TileZoomManager(a, true, a.ja);
this.h.h = !a.f3;
}
a.e5 = true;
a.qx();
this.h.al();
a.dc.br();
a.dc.bs();
};
SeriesViewerInteractionManager.prototype.ad = function (a) {
if (this.h == null) {
return;
}
a.e5 = false;
a.dc.dg();
this.h.ah();
a.rj();
a.dc.by();
};
SeriesViewerInteractionManager.prototype.f$m = function (a) {
a.nx();
a.rl();
};
SeriesViewerInteractionManager.prototype.p = function (a) {
return a.c3 == 2;
};
SeriesViewerInteractionManager.prototype.q = function (a, b) {
return a.cq == 1 || b || a.ek;
};
SeriesViewerInteractionManager.prototype.o = function (a) {
return a.c3 == 1;
};
SeriesViewerInteractionManager.prototype.f$p = function (a, b, c) {
var d = a.dc;
if (this.l) {
a.bd.onScrollbarDrag(b, c);
return;
}
if (this.ap.isEmpty && c) {
this.am(a, b, c);
}
var e = 2;
if (c) {
e = 10;
}
var f = false;
var g = false;
var h = new Rect(2, { $type: Point_$type, x: this.ap.x, y: this.ap.y }, b);
var i = new Rect(0, 0, 0, 0, 0);
if (!this.aq.isEmpty) {
i = new Rect(2, { $type: Point_$type, x: this.aq.x, y: this.aq.y }, b);
}
if (i.width > e || i.height > e) {
g = true;
}
if (i.width > e && i.height > e) {
f = true;
}
if (!a.f2) {
if (f) {
this.k = false;
}
}
if (!a.f2 && (a.eo || !c)) {
a.nz(a.wn(b));
}
if (a.c3 == 3) {
if (f) {
var j = a.w9(h);
a.qy(j, true);
}
else {
a.qy(Rect.empty, true);
}
a.o5(g, b);
d.eg(h);
}
if (this.o(a)) {
if (f) {
var k = a.w9(h);
a.qy(k, true);
}
else {
a.qy(Rect.empty, true);
}
a.o7(g, b);
d.eg(h);
}
var l = a.xb;
var m = a.wt;
if (this.p(a)) {
var n = l;
var o = m.left + m.width * (this.ap.x - b.x) / n.width;
var p = m.top + m.height * (this.ap.y - b.y) / n.height;
var q = new Rect(0, o, p, m.width, m.height);
if (this.q(a, c)) {
if (i.width != 0 || i.height != 0) {
a.qt(g, b);
}
a.qy(Rect.empty, true);
var r = a.wt;
a.sh(q, true);
var s = a.wt;
if (r.equals1(s) && a.dc.k.ac) {
a.dc.k.au();
}
this.ap = new Rect(3, b, new Size(1, 0, 0));
this.ar = new Rect(3, b, new Size(1, 0, 0));
}
else {
a.qy(q, true);
}
}
this.ar = new Rect(3, b, new Size(1, 0, 0));
d.bu(b);
};
SeriesViewerInteractionManager.prototype.f$o = function (a, b, c, d) {
var e = a.dc;
var f = 2;
if (c) {
f = 10;
}
var g = a.xb;
var h = a.wt;
if (!d) {
if (this.l) {
this.f$b.onScrollbarDragComplete(b, c);
this.l = false;
e.bw();
return;
}
}
if (!this.k) {
var i = false;
var j = new Rect(2, { $type: Point_$type, x: this.ap.x, y: this.ap.y }, b);
if (j.width > f && j.height > f) {
i = true;
}
if (a.c3 == 3 && i) {
a.o4();
a.no(j);
e.cf();
}
if (a.c3 == 1) {
a.o6();
e.cf();
if (i) {
a.sh(a.w9(j), true);
}
}
if (a.c3 == 2) {
var k = g;
var l = h.left + h.width * (this.ap.x - b.x) / k.width;
var m = h.top + h.height * (this.ap.y - b.y) / k.height;
a.sh(new Rect(0, l, m, h.width, h.height), true);
}
}
var n = false;
var o = new Rect(2, { $type: Point_$type, x: this.aq.x, y: this.aq.y }, b);
if (o.width > f || o.height > f) {
n = true;
}
if (n) {
a.ge = true;
}
a.c3 = 0;
a.qy(Rect.empty, true);
e.bw();
a.ge = false;
e.cg();
e.cl();
if (c) {
e.ck();
e.cg();
e.cl();
e.ch();
}
a.oe();
a.qs();
a.p7(b, c, d);
};
SeriesViewerInteractionManager.prototype.f$ai = function (a) {
if (this.i != null) {
this.i.h = !a.f3;
}
};
SeriesViewerInteractionManager.prototype.f$g = function (a, b) {
var e_2, _a;
var c = a.dc;
var d = a.wt;
if (a.c3 == 2 && b == 8) {
c.bt();
a.c3 = 0;
a.qs();
a.qy(Rect.empty, true);
if (a.cq == 1) {
a.sh(this.as, true);
}
return true;
}
if (a.c3 == 1 && b == 8) {
c.bt();
a.c3 = 0;
a.qs();
c.cf();
a.qy(Rect.empty, true);
return true;
}
var e = Rect.empty;
var f = false;
switch (b) {
case 13:
f = true;
e = new Rect(0, 0, 0, 1, 1);
break;
case 11:
f = true;
e = new Rect(0, d.left - 0.1 * d.width, d.top - 0.1 * d.height, 1.2 * d.width, 1.2 * d.height);
break;
case 10:
f = true;
e = new Rect(0, d.left + 0.1 * d.width, d.top + 0.1 * d.height, 0.8 * d.width, 0.8 * d.height);
break;
case 14:
if (c.ez == 2) {
f = true;
this.af(a);
}
else {
f = true;
e = new Rect(0, d.left - 0.1 * d.width, d.top, d.width, d.height);
e.x = e.x - Math.min(e.left, 0);
}
break;
case 16:
if (c.ez == 2) {
f = true;
this.ai(a);
}
else {
f = true;
e = new Rect(0, d.left + 0.1 * d.width, d.top, d.width, d.height);
e.x = e.x - Math.max(e.right - 1, 0);
}
break;
case 9:
if (a.focusedSeriesItems.count > 0) {
f = true;
try {
for (var _b = __values(fromEnum(a.focusedSeriesItems)), _c = _b.next(); !_c.done; _c = _b.next()) {
var g = _c.value;
a.qc(g.series, g.item);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
}
break;
case 15:
if (c.ez == 2) {
f = true;
this.ah(a);
}
else {
f = true;
e = new Rect(0, d.left, d.top - 0.1 * d.height, d.width, d.height);
e.y = e.y - Math.min(e.top, 0);
}
break;
case 17:
if (c.ez == 2) {
f = true;
this.ag(a);
}
else {
f = true;
e = new Rect(0, d.left, d.top + 0.1 * d.height, d.width, d.height);
e.y = e.y - Math.max(e.bottom - 1, 0);
}
break;
}
if (!e.isEmpty && Rect.l_op_Inequality(e, d)) {
a.sh(e, true);
}
return f;
};
SeriesViewerInteractionManager.prototype.ai = function (a) {
var b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
var c = null;
if (b != null) {
c = b.series;
}
if (c == null) {
if (a.series.count == 0) {
return;
}
c = a.series._inner[0];
}
if (c != null && c.dp != null) {
if (b == null) {
var d = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(0);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(d);
return;
}
var e_3 = c.dp.indexOf(b.item);
if (e_3 == -1) {
return;
}
e_3++;
if (e_3 > c.dp.count - 1) {
return;
}
var f = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e_3);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
}
};
SeriesViewerInteractionManager.prototype.af = function (a) {
var b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
var c = null;
if (b != null) {
c = b.series;
}
if (c == null) {
if (a.series.count == 0) {
return;
}
c = a.series._inner[0];
}
if (c != null && c.dp != null) {
if (b == null) {
var d = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(0);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(d);
return;
}
var e_4 = c.dp.indexOf(b.item);
if (e_4 == -1) {
return;
}
e_4--;
if (e_4 < 0) {
return;
}
var f = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e_4);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
}
};
SeriesViewerInteractionManager.prototype.ah = function (a) {
var b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
var c = null;
if (b != null) {
c = b.series;
}
if (c == null) {
if (a.series.count == 0) {
return;
}
c = a.series._inner[0];
}
if (c != null) {
var d = a.series.indexOf(c);
if (d == -1) {
return;
}
var e_5 = 0;
if (b != null && b.item != null && c.dp != null) {
e_5 = c.dp.indexOf(b.item);
if (e_5 == -1) {
e_5 = 0;
}
}
d--;
if (d < 0) {
return;
}
c = a.series._inner[d];
if (c.dp == null) {
var f = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = null;
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
return;
}
if (e_5 > c.dp.count - 1) {
e_5 = 0;
}
var g = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e_5);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(g);
}
};
SeriesViewerInteractionManager.prototype.ag = function (a) {
var b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
var c = null;
if (b != null) {
c = b.series;
}
if (c == null) {
if (a.series.count == 0) {
return;
}
c = a.series._inner[0];
}
if (c != null) {
var d = a.series.indexOf(c);
if (d == -1) {
return;
}
var e_6 = 0;
if (b != null && b.item != null && c.dp != null) {
e_6 = c.dp.indexOf(b.item);
if (e_6 == -1) {
e_6 = 0;
}
}
d++;
if (d > a.series.count - 1) {
return;
}
c = a.series._inner[d];
if (c.dp == null) {
var f = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = null;
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
return;
}
if (e_6 > c.dp.count - 1) {
e_6 = 0;
}
var g = ((function () {
var $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e_6);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(g);
}
};
SeriesViewerInteractionManager.prototype.f$h = function (a, b, c) {
var d = a.dc;
var e = a.wt;
var f = e.left + e.width * b.x / a.xb.width;
var g = e.top + e.height * b.y / a.xb.height;
var h = 1 - MathUtil.d(c, -0.5, 0.5);
var i = Math.max(0, f - h * (f - e.left));
var j = Math.min(1, g + h * (e.bottom - g));
var k = Math.min(1, f + h * (e.right - f));
var l = Math.max(0, g - h * (g - e.top));
a.qt(true, b);
this.z(a, 1000);
a.sh(new Rect(0, i, l, k - i, j - l), true);
return a.fo();
};
SeriesViewerInteractionManager.prototype.z = function (a, b) {
a.dc.bz(b);
};
SeriesViewerInteractionManager.prototype.f$r = function (a, b) {
var c = a.wt;
var d = c.left + c.width * b.x / a.xb.width;
var e = c.top + c.height * b.y / a.xb.height;
var f = 0.7;
var g = Math.max(0, d - f * (d - c.left));
var h = Math.min(1, e + f * (c.bottom - e));
var i = Math.min(1, d + f * (c.right - d));
var j = Math.max(0, e - f * (e - c.top));
a.sh(new Rect(0, g, j, i - g, h - j), true);
};
SeriesViewerInteractionManager.prototype.f$l = function (a) {
this.i.ac();
};
SeriesViewerInteractionManager.prototype.f$c = function (a, b, c, d, e, f, g) {
var e_7, _a;
var h = true;
var i = false;
var j = false;
var k = a;
if (k.au == 1) {
h = false;
i = true;
}
if (k.au == 3 || k.au == 4) {
i = true;
}
if (k.au == 4) {
j = true;
}
var l = truncate(Math.round(d.x));
var m = truncate(Math.round(d.y));
f = null;
var n = -1;
if (h && c != null) {
var o = l;
var p = m;
if (a.hp != 1) {
o = truncate(Math.round(d.x * a.hp));
p = truncate(Math.round(d.y * a.hp));
}
var q = c.a(o, p);
if (q == null || q.length == 0) {
f = null;
return {
ret: null,
p5: f
};
}
if ((q[0] > 0 || q[1] > 0 || q[2] > 0) && q[3] == 255) {
var num2_ = q[2];
if (num2_ % 4 != 0) {
num2_ = num2_ + (4 - (num2_ % 4));
}
var num1_ = q[1];
if (num1_ % 4 != 0) {
num1_ = num1_ + (4 - (num1_ % 4));
}
var num0_ = q[0];
if (num0_ % 4 != 0) {
num0_ = num0_ + (4 - (num0_ % 4));
}
var num_ = 0;
num_ = (num2_ >> 2);
num_ = (num_ << 6);
num_ = (num_ | (num1_ >> 2));
num_ = (num_ << 6);
num_ = (num_ | (num0_ >> 2));
n = truncate(Math.floor((intDivide(num_, 1000))));
n--;
}
}
var r = null;
var s = -1;
if (n >= 0) {
var t_1 = false;
var u_1 = 0;
try {
for (var _b = __values(fromEnum(b)), _c = _b.next(); !_c.done; _c = _b.next()) {
var v = _c.value;
if (!v.f9) {
continue;
}
if (t_1) {
break;
}
if (v.isStacked) {
v.p5(function (w) {
if (w.kh == n) {
r = w;
s = u_1;
t_1 = true;
return false;
}
return true;
});
}
else if (v.kh == n) {
r = v;
s = u_1;
break;
}
u_1++;
}
}
catch (e_7_1) {
e_7 = { error: e_7_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_7)
throw e_7.error;
}
}
}
var w = null;
if (i) {
var x = false;
for (var y = b.count - 1; y >= 0; y--) {
var z = b._inner[y];
if (!z.f9) {
continue;
}
var aa = z.cw;
if (!z.hf(aa.b9, aa.ca, aa)) {
continue;
}
if (!x && y < s && h && !j) {
if (r != null) {
w = r;
x = true;
break;
}
}
if (z != null && z.b2 == 1) {
if (z.gx(d, g)) {
w = z;
break;
}
}
}
if (h && !x) {
if (r != null) {
w = r;
x = true;
}
}
}
else {
w = r;
}
if (w != null) {
var ab = w.a2({ $type: Point_$type, x: l, y: m }, g);
if (ab != null) {
f = ab;
}
return {
ret: w,
p5: f
};
}
return {
ret: null,
p5: f
};
};
SeriesViewerInteractionManager.prototype.f$i = function (a, b) {
if (PointUtil.equals(b, null)) {
return false;
}
var c = b.x;
var d = b.y;
if (this.l) {
return true;
}
if (c >= a.xb.left && d >= a.xb.top && c <= a.xb.left + a.xb.width && d <= a.xb.top + a.xb.height) {
var e = a.c5;
if (e != null && e.viewShouldInteract(b)) {
return false;
}
return true;
}
return false;
};
SeriesViewerInteractionManager.prototype.b = function (a) {
if (a != null) {
return a.bq();
}
else {
return null;
}
};
SeriesViewerInteractionManager.prototype.f$z = function (a, b, c, d, e, f) {
var _this = this;
if (!f && a.ej) {
this.an(a, false);
}
var g = new MouseEventArgs();
g.position = d;
if (a.c3 == 2 || a.c3 == 1 || a.f2 || (a.c5 != null && a.c5.isPinching)) {
if (!a.ez && this.c != null) {
this.c.ba.a$af(this.c, g.position, this.a, g, f);
this.c = null;
}
return;
}
var h = null;
var i = ((function () { var j = _this.f$c(a, b, c, d, !e, h, f); h = j.p5; return j.ret; })());
this.a = h;
var j = this.b(i);
if (i != null) {
var k = false;
var l = false;
if (this.c != i) {
l = true;
}
if (this.c == null || l) {
k = true;
}
if (k) {
if (l) {
if (this.c != null) {
j = this.b(this.c);
this.c.ba.a$af(this.c, g.position, h, g, f);
if (j != null) {
j.ba.a$af(j, g.position, h, g, f);
}
}
}
this.c = i;
j = this.b(this.c);
i.qw(g.position, h, g, f);
if (j != null) {
j.qw(g.position, h, g, f);
}
}
else {
this.c = i;
j = this.b(this.c);
i.ba.a$ah(i, g.position, h, g, f);
if (j != null) {
j.ba.a$ah(j, g.position, h, g, f);
}
}
}
else {
if (this.c != null) {
j = this.b(this.c);
this.c.ba.a$af(this.c, g.position, h, g, f);
if (j != null) {
j.ba.a$af(j, g.position, h, g, f);
}
this.c = null;
}
for (var m = 0; m < a.series.count; m++) {
var n = a.series._inner[m];
if (n.ba.a$c) {
j = this.b(n);
n.ba.a$af(n, g.position, n.ba.a$s, g, f);
if (j != null) {
j.ba.a$af(j, g.position, n.ba.a$s, g, f);
}
}
}
}
};
SeriesViewerInteractionManager.prototype.f$y = function (a, b) {
if (this.c != null) {
var c = this.b(this.c);
var d = new MouseEventArgs();
d.position = b;
this.c.ba.a$af(this.c, d.position, null, d, false);
if (c != null) {
c.ba.a$af(c, d.position, null, d, false);
}
this.c = null;
}
a.p1(b, a.c3 != 0 || a.ft);
};
SeriesViewerInteractionManager.prototype.f$x = function (a, b, c) {
if (this.c != null) {
var d = new MouseButtonEventArgs();
d.position = c;
if (b.al) {
this.c.ba.a$ai(this.c, d.position, this.a, d);
}
else {
this.c.ba.a$ac(this.c, d.position, this.a, d);
}
}
};
SeriesViewerInteractionManager.prototype.f$aa = function (a, b, c) {
var d;
var e = (this.c != null) ? this.c : ((function () { var f = a.dc.f(c, false, d, false); d = f.p2; return f.ret; })());
if (e != null) {
var f = new MouseButtonEventArgs();
f.position = c;
if (b.al) {
e.ba.a$aj(e, f.position, this.a, f);
}
else {
e.ba.a$ag(e, f.position, this.a, f);
}
}
};
SeriesViewerInteractionManager.prototype.f$w = function (a, b, c) {
if (!c && a.fv) {
this.an(a, false);
}
if (c && !a.fv) {
this.an(a, true);
}
a.pc(b, c);
};
SeriesViewerInteractionManager.prototype.an = function (a, b) {
if (a != null) {
if (!this.m) {
a.ej = b;
}
}
};
SeriesViewerInteractionManager.prototype.f$ad = function (a, b) {
this.j = true;
};
Object.defineProperty(SeriesViewerInteractionManager.prototype, "m", {
get: function () {
return this.j;
},
enumerable: false,
configurable: true
});
SeriesViewerInteractionManager.$t = markType(SeriesViewerInteractionManager, 'SeriesViewerInteractionManager', Base.$, [ISeriesViewerInteractionManager_$type]);
return SeriesViewerInteractionManager;
}(Base));
export { SeriesViewerInteractionManager };