igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,504 lines (1,503 loc) • 46.1 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.y = 0;
_this.z = 0;
_this.ar = null;
_this.v = 0;
_this.w = 0;
_this.u = 0;
_this.x = 0;
_this.k = false;
_this.l = false;
_this.as = null;
_this.au = null;
_this.m = false;
_this.q = false;
_this.h = null;
_this.e = null;
_this.f = null;
_this.d = null;
_this.g = null;
_this.at = null;
_this.av = null;
_this.c = null;
_this.a = null;
_this.j = false;
_this.at = Rect.empty;
_this.as = 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.dp.e();
var f;
var g = ((function () { var h = a.dp.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.su(b);
a.oj(b, false, false, false, false);
}
if (g != null && !g.ba.a$e) {
g.ba.a$ae(g, b, c, d, false);
}
};
SeriesViewerInteractionManager.prototype.f$a = function (a) {
if (a.a7 != 0) {
return a.a7;
}
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.p9(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.xe;
var c = b;
var d = a.dp;
var e = a.ex();
var f = a.e0;
var g = a.gf;
var h = a.gr;
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.qi(c);
}
a.o9(c);
var k = a.df == 0 && !a.fk && (a.e6 || f) && !g && !h;
var l = a.x5;
var m = a.xr;
if (k && !isNaN_(b.x) && !l.isEmpty) {
var n = ViewportUtils.e(b.x, a.xn, 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.xn, l, m);
d.eh(l.left, o, l.right, o);
d.d9();
}
else {
d.cg();
}
};
SeriesViewerInteractionManager.prototype.f$aj = function (a) {
switch (a.df) {
case 0:
a.dp.d5();
this.f$ar(a);
a.dp.cd();
break;
case 1:
a.dp.d7();
a.dp.ck();
this.f$ar(a);
a.dp.cc();
break;
case 2:
a.dp.d7();
a.dp.ck();
this.f$ar(a);
a.dp.ce();
break;
}
};
SeriesViewerInteractionManager.prototype.f$t = function (a, b) {
if (b.x >= 0 && b.y >= 0 && b.x <= a.x5.width && b.y <= a.x5.height) {
this.an(a, b);
}
else {
a.ov();
}
};
SeriesViewerInteractionManager.prototype.an = function (a, b) {
var e_1, _a;
var c = a.dp;
var d = a.x5;
if (a.fl || a.fk) {
return;
}
if (a.e0 && a.e6) {
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.p9(function (g) {
if (g._visibility == 0) {
g.se(b, runOn(c, c.bm));
}
if (g.ei) {
g.p7(function (h) {
if (h._visibility == 0) {
h.se(b, runOn(c, c.bm));
}
return true;
});
}
return true;
});
}
else if (f.ei) {
if (f._visibility == 0) {
if (f._visibility == 0) {
f.se(b, runOn(c, c.bm));
}
}
f.p7(function (g) {
if (g._visibility == 0) {
g.se(b, runOn(c, c.bm));
}
return true;
});
}
else {
if (f._visibility == 0) {
f.se(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.am = function (a, b) {
if (a.e6 || a.fi) {
a.e0 = true;
a.q9();
this.as = new Rect(0, b.x, b.y, 0, 0);
this.au = new Rect(0, b.x, b.y, 0, 0);
a.df = 0;
a.of(a.xh(b));
}
};
SeriesViewerInteractionManager.prototype.f$ah = function (a, b) {
this.am(a, b);
this.an(a, b);
this.f$ar(a);
};
SeriesViewerInteractionManager.prototype.f$u = function (a, b, c) {
if (!a.e0) {
this.ap(a, b, c);
}
};
SeriesViewerInteractionManager.prototype.f$s = function (a, b) {
this.at = Rect.empty;
a.ov();
};
SeriesViewerInteractionManager.prototype.f$ao = function (a, b) {
if (this.m) {
this.f$b.onScrollbarDragCancel();
this.m = false;
}
var c = a.dp;
this.x = 1;
this.ah(a);
a.df = 0;
this.k = true;
a.gf = true;
a.ra(true, b);
};
SeriesViewerInteractionManager.prototype.ah = function (a) {
var b = a.dp;
a.e0 = false;
b.cj();
b.cf();
b.ch();
a.of({ $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.y = b.x;
this.z = b.y;
this.v = c;
this.w = d;
this.u = e;
this.ar = a.xn;
this.f$ao(a, b);
};
SeriesViewerInteractionManager.prototype.f$af = function (a, b) {
var c = a.dp;
c.cg();
c.cl();
if (c.av) {
this.ad(a, b);
}
else {
this.af(a, b);
this.x = b;
}
};
SeriesViewerInteractionManager.prototype.f$al = function (a, b, c, d, e) {
var f = a.dp;
f.cg();
f.cl();
this.v = this.v * c;
this.w = this.w * d;
this.u = this.u * e;
if (a.fr) {
this.v = this.u;
this.w = this.u;
}
var g = a.xn;
var h = a.x5;
var i = b.x - this.y;
var j = b.y - this.z;
this.y = b.x;
this.z = b.y;
var k = g.width;
var l = g.height;
var m = this.ar.width / this.v;
var n = this.ar.height / this.w;
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.ta(g, true);
};
SeriesViewerInteractionManager.prototype.f$ac = function (a, b) {
this.as = new Rect(0, b.x, b.y, 0, 0);
this.au = new Rect(0, b.x, b.y, 0, 0);
};
SeriesViewerInteractionManager.prototype.ae = function (a, b, c) {
var d = a.xn.width;
var e = a.xn.height;
var f = a.xn.left + d / 2;
var g = a.xn.top + e / 2;
d = d / b;
e = e / b;
var h = f - d / 2;
var i = g - e / 2;
a.ta(new Rect(0, h, i, d, e), true);
};
SeriesViewerInteractionManager.prototype.f$ae = function (a, b) {
var c = a.dp;
if (c.av) {
this.ad(a, b);
}
else {
this.af(a, b);
}
this.as = Rect.empty;
a.gf = false;
};
SeriesViewerInteractionManager.prototype.f$v = function (a, b) {
a.gf = false;
this.as = Rect.empty;
a.ov();
};
SeriesViewerInteractionManager.prototype.f$ab = function (a, b) {
a.n8();
};
SeriesViewerInteractionManager.prototype.f$ak = function (a, b, c, d, e) {
a.gf = false;
this.as = Rect.empty;
a.ov();
};
SeriesViewerInteractionManager.prototype.ad = function (a, b) {
var c = a.x6;
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.ta(g, true);
};
SeriesViewerInteractionManager.prototype.af = function (a, b) {
var c = a.x5;
var d = a.x6;
var e = b - this.x;
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.ta(j, true);
}
};
SeriesViewerInteractionManager.prototype.f$q = function (a, b, c) {
if (!this.p(a, b, true)) {
return;
}
if (!a.gf) {
this.k = false;
}
var d = false;
if (a.e1) {
if (this.f$b.shouldHandleInteraction(b, c)) {
this.m = true;
d = true;
this.ah(a);
a.dp.dr();
return;
}
}
this.ap(a, b, c);
a.qn(b, c);
};
SeriesViewerInteractionManager.prototype.ap = function (a, b, c) {
var d;
var e = a.dp;
if (a.dc != 0) {
d = a.dc;
}
else if (e.ez == 0) {
var f = a.dd(c);
switch (f) {
case 1:
d = a.f1() ? f : 0;
break;
default:
d = f;
break;
}
}
else {
if (e.ez == a.wk) {
d = 1;
}
else if (e.ez == a.wl) {
d = 2;
}
else if (e.ez == a.wm) {
d = 3;
}
else {
d = 0;
}
}
switch (d) {
case 1:
case 2:
case 3:
a.dp.ca();
a.dp.dr();
break;
}
a.df = d;
switch (a.df) {
case 1:
this.as = new Rect(0, b.x, b.y, 0, 0);
this.au = new Rect(0, b.x, b.y, 0, 0);
this.at = new Rect(0, b.x, b.y, 0, 0);
e.d8();
e.eg(this.as);
a.rf(Rect.empty, true);
break;
case 2:
this.as = new Rect(0, b.x, b.y, 0, 0);
this.at = new Rect(0, b.x, b.y, 0, 0);
break;
case 3:
this.as = new Rect(0, b.x, b.y, 0, 0);
this.au = new Rect(0, b.x, b.y, 0, 0);
this.at = new Rect(0, b.x, b.y, 0, 0);
e.d8();
e.eg(this.as);
a.rf(Rect.empty, true);
break;
}
this.av = a.xn;
a.x7 = a.xn;
};
SeriesViewerInteractionManager.prototype.f$an = function (a) {
a.sv();
a.dp.dl();
};
SeriesViewerInteractionManager.prototype.f$am = function (a) {
a.ok();
a.dp.dk();
};
SeriesViewerInteractionManager.prototype.f$at = function (a) {
if (a.ew && !this.q) {
this.q = true;
this.ao(a);
}
};
SeriesViewerInteractionManager.prototype.f$n = function (a) {
if (this.q) {
this.ag(a);
this.q = 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.ao = function (a) {
if (this.h == null) {
this.h = new TileZoomManager(a, true, a.jp);
this.h.h = !a.gg;
}
a.fh = true;
a.re();
this.h.al();
a.dp.br();
a.dp.bs();
};
SeriesViewerInteractionManager.prototype.ag = function (a) {
if (this.h == null) {
return;
}
a.fh = false;
a.dp.dg();
this.h.ah();
a.sc();
a.dp.by();
};
SeriesViewerInteractionManager.prototype.f$m = function (a) {
a.od();
a.se();
};
SeriesViewerInteractionManager.prototype.s = function (a) {
return a.df == 2;
};
SeriesViewerInteractionManager.prototype.t = function (a, b) {
return a.c2 == 1 || b || a.ew;
};
SeriesViewerInteractionManager.prototype.r = function (a) {
return a.df == 1;
};
SeriesViewerInteractionManager.prototype.f$p = function (a, b, c) {
var d = a.dp;
if (this.m) {
a.bp.onScrollbarDrag(b, c);
return;
}
if (this.as.isEmpty && c) {
this.ap(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.as.x, y: this.as.y }, b);
var i = new Rect(0, 0, 0, 0, 0);
if (!this.at.isEmpty) {
i = new Rect(2, { $type: Point_$type, x: this.at.x, y: this.at.y }, b);
}
if (i.width > e || i.height > e) {
g = true;
}
if (i.width > e && i.height > e) {
f = true;
}
if (!a.gf) {
if (f) {
this.k = false;
}
}
if (!a.gf && (a.e0 || !c)) {
a.of(a.xh(b));
}
if (a.df == 3) {
if (f) {
var j = a.x3(h);
a.rf(j, true);
}
else {
a.rf(Rect.empty, true);
}
a.pm(g, b);
d.eg(h);
}
if (this.r(a)) {
if (f) {
var k = a.x3(h);
a.rf(k, true);
}
else {
a.rf(Rect.empty, true);
}
a.po(g, b);
d.eg(h);
}
var l = a.x5;
var m = a.xn;
if (this.s(a)) {
var n = l;
var o = m.left + m.width * (this.as.x - b.x) / n.width;
var p = m.top + m.height * (this.as.y - b.y) / n.height;
var q = new Rect(0, o, p, m.width, m.height);
if (this.t(a, c)) {
if (i.width != 0 || i.height != 0) {
a.ra(g, b);
}
a.rf(Rect.empty, true);
var r = a.xn;
a.ta(q, true);
var s = a.xn;
if (r.equals1(s) && a.dp.k.ac) {
a.dp.k.au();
}
this.as = new Rect(3, b, new Size(1, 0, 0));
this.au = new Rect(3, b, new Size(1, 0, 0));
}
else {
a.rf(q, true);
}
}
this.au = new Rect(3, b, new Size(1, 0, 0));
d.bu(b);
};
SeriesViewerInteractionManager.prototype.f$o = function (a, b, c, d) {
var e = a.dp;
var f = 2;
if (c) {
f = 10;
}
var g = a.x5;
var h = a.xn;
if (!d) {
if (this.m) {
this.f$b.onScrollbarDragComplete(b, c);
this.m = false;
e.bw();
return;
}
}
if (!this.k) {
var i = false;
var j = new Rect(2, { $type: Point_$type, x: this.as.x, y: this.as.y }, b);
if (j.width > f && j.height > f) {
i = true;
}
if (a.df == 3 && i) {
a.pl();
a.n4(j);
e.cf();
}
if (a.df == 1) {
a.pn();
e.cf();
if (i) {
a.ta(a.x3(j), true);
}
}
if (a.df == 2) {
var k = g;
var l = h.left + h.width * (this.as.x - b.x) / k.width;
var m = h.top + h.height * (this.as.y - b.y) / k.height;
a.ta(new Rect(0, l, m, h.width, h.height), true);
}
}
var n = false;
var o = new Rect(2, { $type: Point_$type, x: this.at.x, y: this.at.y }, b);
if (o.width > f || o.height > f) {
n = true;
}
if (n) {
a.gr = true;
}
a.df = 0;
a.rf(Rect.empty, true);
e.bw();
a.gr = false;
e.cg();
e.cl();
if (c) {
e.ck();
e.cg();
e.cl();
e.ch();
}
a.ov();
a.q9();
a.qo(b, c, d);
};
SeriesViewerInteractionManager.prototype.f$ai = function (a) {
if (this.i != null) {
this.i.h = !a.gg;
}
};
SeriesViewerInteractionManager.prototype.f$g = function (a, b) {
var e_2, _a;
var c = a.dp;
var d = a.xn;
if (a.df == 2 && b == 8) {
c.bt();
a.df = 0;
a.q9();
a.rf(Rect.empty, true);
if (a.c2 == 1) {
a.ta(this.av, true);
}
return true;
}
if (a.df == 1 && b == 8) {
c.bt();
a.df = 0;
a.q9();
c.cf();
a.rf(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.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.min(e.left, 0);
}
break;
case 16:
if (c.ez == 2) {
f = true;
this.al(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.qt(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.ak(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.aj(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.ta(e, true);
}
return f;
};
SeriesViewerInteractionManager.prototype.al = 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.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_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.ak = 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.aj = 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.dp;
var e = a.xn;
var f = e.left + e.width * b.x / a.x5.width;
var g = e.top + e.height * b.y / a.x5.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.ra(true, b);
this.ac(a, 1000);
a.ta(new Rect(0, i, l, k - i, j - l), true);
return a.f1();
};
SeriesViewerInteractionManager.prototype.ac = function (a, b) {
a.dp.bz(b);
};
SeriesViewerInteractionManager.prototype.f$r = function (a, b) {
var c = a.xn;
var d = c.left + c.width * b.x / a.x5.width;
var e = c.top + c.height * b.y / a.x5.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.ta(new Rect(0, g, j, i - g, h - j), true);
};
SeriesViewerInteractionManager.prototype.f$l = function (a) {
this.i.ac();
};
SeriesViewerInteractionManager.prototype.p = function (a, b, c) {
var d = b.x;
var e = b.y;
if (c) {
d += a.x5.left;
e += a.x5.top;
}
return d >= a.x5.left && e >= a.x5.top && d <= a.x5.left + a.x5.width && e <= a.x5.top + a.x5.height;
};
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.a6 == 1) {
h = false;
i = true;
}
if (k.a6 == 3 || k.a6 == 4) {
i = true;
}
if (k.a6 == 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.h3 != 1) {
o = truncate(Math.round(d.x * a.h3));
p = truncate(Math.round(d.y * a.h3));
}
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.p9(function (w) {
if (w.kk == n) {
r = w;
s = u_1;
t_1 = true;
return false;
}
return true;
});
}
else if (v.kk == 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;
}
if (this.m) {
return true;
}
if (this.p(a, b, false)) {
var c = a.dh;
if (c != null && c.viewShouldInteract(b)) {
return false;
}
return true;
}
return this.o(a, b);
};
SeriesViewerInteractionManager.prototype.o = function (a, b) {
return a.fu(b);
};
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;
a.oj(d, f, false, false, false);
if (!this.p(a, d, false)) {
if (this.l) {
this.l = false;
this.f$y(a, d);
}
return;
}
this.l = true;
if (!f && a.ev) {
this.aq(a, false);
}
var g = new MouseEventArgs();
g.position = d;
if (a.df == 2 || a.df == 1 || a.gf || (a.dh != null && a.dh.isPinching)) {
if (!a.fb && 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.q1(g.position, h, g, f);
if (j != null) {
j.q1(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.qi(b, a.df != 0 || a.f6);
a.oj(b, false, false, false, false);
};
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);
}
}
a.oj(c, false, true, false, false);
};
SeriesViewerInteractionManager.prototype.f$aa = function (a, b, c) {
var d;
var e = (this.c != null) ? this.c : ((function () { var f = a.dp.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);
}
}
a.oj(c, false, false, true, false);
};
SeriesViewerInteractionManager.prototype.f$w = function (a, b, c) {
if (!this.p(a, b, false)) {
return;
}
if (!c && a.f8) {
this.aq(a, false);
}
if (c && !a.f8) {
this.aq(a, true);
}
a.pt(b, c);
};
SeriesViewerInteractionManager.prototype.aq = function (a, b) {
if (a != null) {
if (!this.n) {
a.ev = b;
}
}
};
SeriesViewerInteractionManager.prototype.f$ad = function (a, b) {
this.j = true;
};
Object.defineProperty(SeriesViewerInteractionManager.prototype, "n", {
get: function () {
return this.j;
},
enumerable: false,
configurable: true
});
SeriesViewerInteractionManager.$t = markType(SeriesViewerInteractionManager, 'SeriesViewerInteractionManager', Base.$, [ISeriesViewerInteractionManager_$type]);
return SeriesViewerInteractionManager;
}(Base));
export { SeriesViewerInteractionManager };