igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,426 lines (1,425 loc) • 44.9 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, Point_$type, 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
*/
export let SeriesViewerInteractionManager = /*@__PURE__*/ (() => {
class SeriesViewerInteractionManager extends Base {
constructor() {
super();
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;
}
get f$e() {
if (this.e == null) {
this.e = new SeriesHighlightingManager();
}
return this.e;
}
get f$f() {
if (this.f == null) {
this.f = new SeriesSelectionHighlightingManager();
}
return this.f;
}
get f$d() {
if (this.d == null) {
this.d = new SeriesFocusHighlightingManager();
}
return this.d;
}
get f$b() {
if (this.g == null) {
this.g = new SeriesViewerScrollbarManager();
}
return this.g;
}
f$j(a, b, c) {
let d = a.dc;
if (a.bo != null) {
a = a.bo;
}
if (a.bl != null) {
a = a.bl;
}
let e = ((() => {
let $ret = new ChartSelection();
$ret.item = b;
$ret.series = a;
return $ret;
})());
let f = a.dc.selectedSeriesItems;
if (f.contains(e)) {
return;
}
a.dc.selectedSeriesItems.add(e);
}
f$aq(a, b, c) {
let d = a.dc;
if (a.bo != null) {
a = a.bo;
}
if (a.bl != null) {
a = a.bl;
}
let e = ((() => {
let $ret = new ChartSelection();
$ret.item = b;
$ret.series = a;
return $ret;
})());
let f = a.dc.selectedSeriesItems;
if (!f.contains(e)) {
return;
}
a.dc.selectedSeriesItems.remove(e);
}
f$as(a, b) {
let c = null;
let d = null;
let e = null;
e = a.dp.e();
let f;
let g = ((() => { let 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);
}
}
f$a(a) {
if (a.a7 != 0) {
return a.a7;
}
let b = 1;
let c = false;
let d = false;
for (let e = 0; e < a.series.count; e++) {
let f = a.series._inner[e];
if (f.isStacked) {
f.p9((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;
}
f$ar(a) {
let b = a.xe;
let c = b;
let d = a.dp;
let e = a.ex();
let f = a.e0;
let g = a.gf;
let 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 (let i = 0; i < a.series.count; i++) {
let j = a.series._inner[i];
j.qi(c);
}
a.o9(c);
let k = a.df == 0 && !a.fk && (a.e6 || f) && !g && !h;
let l = a.x5;
let m = a.xr;
if (k && !isNaN_(b.x) && !l.isEmpty) {
let 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) {
let o = ViewportUtils.i(b.y, a.xn, l, m);
d.eh(l.left, o, l.right, o);
d.d9();
}
else {
d.cg();
}
}
f$aj(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;
}
}
f$t(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();
}
}
an(a, b) {
let c = a.dp;
let d = a.x5;
if (a.fl || a.fk) {
return;
}
if (a.e0 && a.e6) {
let e = d.height > d.width;
c.bv(e);
for (let f of fromEnum(a.series)) {
if (f.isStacked) {
f.p9((g) => {
if (g._visibility == 0) {
g.se(b, runOn(c, c.bm));
}
if (g.ei) {
g.p7((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((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));
}
}
}
c.ea();
}
}
am(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));
}
}
f$ah(a, b) {
this.am(a, b);
this.an(a, b);
this.f$ar(a);
}
f$u(a, b, c) {
if (!a.e0) {
this.ap(a, b, c);
}
}
f$s(a, b) {
this.at = Rect.empty;
a.ov();
}
f$ao(a, b) {
if (this.m) {
this.f$b.onScrollbarDragCancel();
this.m = false;
}
let c = a.dp;
this.x = 1;
this.ah(a);
a.df = 0;
this.k = true;
a.gf = true;
a.ra(true, b);
}
ah(a) {
let 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();
}
f$ag(a, b) {
this.f$ao(a, b);
}
f$ap(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);
}
f$af(a, b) {
let c = a.dp;
c.cg();
c.cl();
if (c.av) {
this.ad(a, b);
}
else {
this.af(a, b);
this.x = b;
}
}
f$al(a, b, c, d, e) {
let 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;
}
let g = a.xn;
let h = a.x5;
let i = b.x - this.y;
let j = b.y - this.z;
this.y = b.x;
this.z = b.y;
let k = g.width;
let l = g.height;
let m = this.ar.width / this.v;
let n = this.ar.height / this.w;
if (m > 1) {
m = 1;
}
if (n > 1) {
n = 1;
}
let o = { $type: Point_$type, x: b.x, y: b.y };
let 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 };
let q = new Rect(0, g.left, g.top, m, n);
let 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 };
let s = (r.x - o.x) - i;
let t = (r.y - o.y) - j;
let u = s / h.width * q.width;
let 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);
}
f$ac(a, b) {
this.as = new Rect(0, b.x, b.y, 0, 0);
this.au = new Rect(0, b.x, b.y, 0, 0);
}
ae(a, b, c) {
let d = a.xn.width;
let e = a.xn.height;
let f = a.xn.left + d / 2;
let g = a.xn.top + e / 2;
d = d / b;
e = e / b;
let h = f - d / 2;
let i = g - e / 2;
a.ta(new Rect(0, h, i, d, e), true);
}
f$ae(a, b) {
let c = a.dp;
if (c.av) {
this.ad(a, b);
}
else {
this.af(a, b);
}
this.as = Rect.empty;
a.gf = false;
}
f$v(a, b) {
a.gf = false;
this.as = Rect.empty;
a.ov();
}
f$ab(a, b) {
a.n8();
}
f$ak(a, b, c, d, e) {
a.gf = false;
this.as = Rect.empty;
a.ov();
}
ad(a, b) {
let c = a.x6;
let d = 1 / b;
let e = { $type: Point_$type, x: c.x + c.width / 2, y: c.y + c.height / 2 };
let f = { $type: Point_$type, x: c.x - e.x, y: c.y - e.y };
let g = new Rect(0, f.x * d + e.x, f.y * d + e.y, c.width * d, c.height * d);
a.ta(g, true);
}
af(a, b) {
let c = a.x5;
let d = a.x6;
let e = b - this.x;
if (e != 0) {
let f = 0.03;
let g = e < 0 ? 1 + f : 1 - f;
let h = { $type: Point_$type, x: d.x + d.width / 2, y: d.y + d.height / 2 };
let i = { $type: Point_$type, x: d.x - h.x, y: d.y - h.y };
let j = new Rect(0, i.x * g + h.x, i.y * g + h.y, d.width * g, d.height * g);
a.ta(j, true);
}
}
f$q(a, b, c) {
if (!this.p(a, b, true)) {
return;
}
if (!a.gf) {
this.k = false;
}
let 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);
}
ap(a, b, c) {
let d;
let e = a.dp;
if (a.dc != 0) {
d = a.dc;
}
else if (e.ez == 0) {
let 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;
}
f$an(a) {
a.sv();
a.dp.dl();
}
f$am(a) {
a.ok();
a.dp.dk();
}
f$at(a) {
if (a.ew && !this.q) {
this.q = true;
this.ao(a);
}
}
f$n(a) {
if (this.q) {
this.ag(a);
this.q = false;
}
}
f$k(a) {
if (this.h == null) {
return;
}
this.i.ab();
}
get i() {
return this.h;
}
ao(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();
}
ag(a) {
if (this.h == null) {
return;
}
a.fh = false;
a.dp.dg();
this.h.ah();
a.sc();
a.dp.by();
}
f$m(a) {
a.od();
a.se();
}
s(a) {
return a.df == 2;
}
t(a, b) {
return a.c2 == 1 || b || a.ew;
}
r(a) {
return a.df == 1;
}
f$p(a, b, c) {
let d = a.dp;
if (this.m) {
a.bp.onScrollbarDrag(b, c);
return;
}
if (this.as.isEmpty && c) {
this.ap(a, b, c);
}
let e = 2;
if (c) {
e = 10;
}
let f = false;
let g = false;
let h = new Rect(2, { $type: Point_$type, x: this.as.x, y: this.as.y }, b);
let 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) {
let 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) {
let k = a.x3(h);
a.rf(k, true);
}
else {
a.rf(Rect.empty, true);
}
a.po(g, b);
d.eg(h);
}
let l = a.x5;
let m = a.xn;
if (this.s(a)) {
let n = l;
let o = m.left + m.width * (this.as.x - b.x) / n.width;
let p = m.top + m.height * (this.as.y - b.y) / n.height;
let 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);
let r = a.xn;
a.ta(q, true);
let 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);
}
f$o(a, b, c, d) {
let e = a.dp;
let f = 2;
if (c) {
f = 10;
}
let g = a.x5;
let h = a.xn;
if (!d) {
if (this.m) {
this.f$b.onScrollbarDragComplete(b, c);
this.m = false;
e.bw();
return;
}
}
if (!this.k) {
let i = false;
let 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) {
let k = g;
let l = h.left + h.width * (this.as.x - b.x) / k.width;
let m = h.top + h.height * (this.as.y - b.y) / k.height;
a.ta(new Rect(0, l, m, h.width, h.height), true);
}
}
let n = false;
let 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);
}
f$ai(a) {
if (this.i != null) {
this.i.h = !a.gg;
}
}
f$g(a, b) {
let c = a.dp;
let 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;
}
let e = Rect.empty;
let 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;
for (let g of fromEnum(a.focusedSeriesItems)) {
a.qt(g.series, g.item);
}
}
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;
}
al(a) {
let b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
let 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) {
let d = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(0);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(d);
return;
}
let e = c.dp.indexOf(b.item);
if (e == -1) {
return;
}
e++;
if (e > c.dp.count - 1) {
return;
}
let f = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
}
}
ai(a) {
let b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
let 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) {
let d = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(0);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(d);
return;
}
let e = c.dp.indexOf(b.item);
if (e == -1) {
return;
}
e--;
if (e < 0) {
return;
}
let f = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
}
}
ak(a) {
let b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
let 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) {
let d = a.series.indexOf(c);
if (d == -1) {
return;
}
let e = 0;
if (b != null && b.item != null && c.dp != null) {
e = c.dp.indexOf(b.item);
if (e == -1) {
e = 0;
}
}
d--;
if (d < 0) {
return;
}
c = a.series._inner[d];
if (c.dp == null) {
let f = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = null;
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
return;
}
if (e > c.dp.count - 1) {
e = 0;
}
let g = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(g);
}
}
aj(a) {
let b = null;
if (a.focusedSeriesItems.count > 0) {
b = a.focusedSeriesItems._inner[0];
}
let 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) {
let d = a.series.indexOf(c);
if (d == -1) {
return;
}
let e = 0;
if (b != null && b.item != null && c.dp != null) {
e = c.dp.indexOf(b.item);
if (e == -1) {
e = 0;
}
}
d++;
if (d > a.series.count - 1) {
return;
}
c = a.series._inner[d];
if (c.dp == null) {
let f = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = null;
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(f);
return;
}
if (e > c.dp.count - 1) {
e = 0;
}
let g = ((() => {
let $ret = new ChartSelection();
$ret.series = c;
$ret.item = c.dp.item(e);
return $ret;
})());
a.focusedSeriesItems.clear();
a.focusedSeriesItems.add(g);
}
}
f$h(a, b, c) {
let d = a.dp;
let e = a.xn;
let f = e.left + e.width * b.x / a.x5.width;
let g = e.top + e.height * b.y / a.x5.height;
let h = 1 - MathUtil.d(c, -0.5, 0.5);
let i = Math.max(0, f - h * (f - e.left));
let j = Math.min(1, g + h * (e.bottom - g));
let k = Math.min(1, f + h * (e.right - f));
let 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();
}
ac(a, b) {
a.dp.bz(b);
}
f$r(a, b) {
let c = a.xn;
let d = c.left + c.width * b.x / a.x5.width;
let e = c.top + c.height * b.y / a.x5.height;
let f = 0.7;
let g = Math.max(0, d - f * (d - c.left));
let h = Math.min(1, e + f * (c.bottom - e));
let i = Math.min(1, d + f * (c.right - d));
let j = Math.max(0, e - f * (e - c.top));
a.ta(new Rect(0, g, j, i - g, h - j), true);
}
f$l(a) {
this.i.ac();
}
p(a, b, c) {
let d = b.x;
let 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;
}
f$c(a, b, c, d, e, f, g) {
let h = true;
let i = false;
let j = false;
let 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;
}
let l = truncate(Math.round(d.x));
let m = truncate(Math.round(d.y));
f = null;
let n = -1;
if (h && c != null) {
let o = l;
let p = m;
if (a.h3 != 1) {
o = truncate(Math.round(d.x * a.h3));
p = truncate(Math.round(d.y * a.h3));
}
let 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) {
let num2_ = q[2];
if (num2_ % 4 != 0) {
num2_ = num2_ + (4 - (num2_ % 4));
}
let num1_ = q[1];
if (num1_ % 4 != 0) {
num1_ = num1_ + (4 - (num1_ % 4));
}
let num0_ = q[0];
if (num0_ % 4 != 0) {
num0_ = num0_ + (4 - (num0_ % 4));
}
let 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--;
}
}
let r = null;
let s = -1;
if (n >= 0) {
let t = false;
let u = 0;
for (let v of fromEnum(b)) {
if (!v.f9) {
continue;
}
if (t) {
break;
}
if (v.isStacked) {
v.p9((w) => {
if (w.kk == n) {
r = w;
s = u;
t = true;
return false;
}
return true;
});
}
else if (v.kk == n) {
r = v;
s = u;
break;
}
u++;
}
}
let w = null;
if (i) {
let x = false;
for (let y = b.count - 1; y >= 0; y--) {
let z = b._inner[y];
if (!z.f9) {
continue;
}
let 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) {
let 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
};
}
f$i(a, b) {
if (PointUtil.equals(b, null)) {
return false;
}
if (this.m) {
return true;
}
if (this.p(a, b, false)) {
let c = a.dh;
if (c != null && c.viewShouldInteract(b)) {
return false;
}
return true;
}
return this.o(a, b);
}
o(a, b) {
return a.fu(b);
}
b(a) {
if (a != null) {
return a.bq();
}
else {
return null;
}
}
f$z(a, b, c, d, e, f) {
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);
}
let 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;
}
let h = null;
let i = ((() => { let j = this.f$c(a, b, c, d, !e, h, f); h = j.p5; return j.ret; })());
this.a = h;
let j = this.b(i);
if (i != null) {
let k = false;
let 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 (let m = 0; m < a.series.count; m++) {
let 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);
}
}
}
}
}
f$y(a, b) {
if (this.c != null) {
let c = this.b(this.c);
let 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);
}
f$x(a, b, c) {
if (this.c != null) {
let 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);
}
f$aa(a, b, c) {
let d;
let e = (this.c != null) ? this.c : ((() => { let f = a.dp.f(c, false, d, false); d = f.p2; return f.ret; })());
if (e != null) {
let 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);
}
f$w(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);
}
aq(a, b) {
if (a != null) {
if (!this.n) {
a.ev = b;
}
}
}
f$ad(a, b) {
this.j = true;
}
get n() {
return this.j;
}
}
SeriesViewerInteractionManager.$t = /*@__PURE__*/ markType(SeriesViewerInteractionManager, 'SeriesViewerInteractionManager', Base.$, [ISeriesViewerInteractionManager_$type]);
return SeriesViewerInteractionManager;
})();