igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
107 lines (106 loc) • 3.98 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, Point_$type, markType } from "igniteui-react-core";
import { IVerticalAnchoredCategorySeriesInteractionManager_$type } from "./IVerticalAnchoredCategorySeriesInteractionManager";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { ArrayExtension } from "igniteui-react-core";
/**
* @hidden
*/
export let VerticalAnchoredCategorySeriesInteractionManager = /*@__PURE__*/ (() => {
class VerticalAnchoredCategorySeriesInteractionManager extends Base {
e$a(a, b) {
let c = a.dc != null ? a.dc.xn : Rect.empty;
let d = a.cw.b9;
let e = a.wu(a.cw);
let f = a.getEffectiveViewport1(a.cw);
let g = a.a0();
let h = -1;
if (g != null && !c.isEmpty && !d.isEmpty) {
let i = new ScalerParams(0, c, d, g.df, f);
let j = g.fw(e.top, i);
let k = g.fw(e.bottom, i);
let l = (b.y - c.top) / c.height;
let m = j + (l * (k - j));
if (g.categoryMode != 0) {
m -= 0.5;
}
h = m;
}
return h;
}
e$b(a, b, c, d) {
if (b == null || b.count == 0) {
return Rect.empty;
}
let e = a.wi(c);
let f = -1;
let g = a.a0().df;
let h = a.cw.b9.bottom * 2;
if (g) {
f = ArrayExtension.binarySearch$11(Point_$type, b, (i) => (h - e.y) < (h - i.y) ? -1 : ((h - e.y) > (h - i.y) ? 1 : 0));
}
else {
f = ArrayExtension.binarySearch$11(Point_$type, b, (i) => e.y < i.y ? -1 : (e.y > i.y ? 1 : 0));
}
if (f < 0) {
f = ~f;
}
if (f < 0) {
f = 0;
}
if (f > b.count - 1) {
f = b.count - 1;
}
let i = f;
let j = f;
if (i > 0) {
i--;
}
if (j < b.count - 1) {
j++;
}
let k = b._inner[i].y;
let l = b._inner[f].y;
let m = b._inner[j].y;
let n = Math.abs(k - e.y);
let o = Math.abs(l - e.y);
let p = Math.abs(m - e.y);
let q = d(i);
let r = d(f);
let s = d(j);
let t = q.containsPoint(e);
let u = r.containsPoint(e);
let v = s.containsPoint(e);
if (o <= n && o <= p) {
if (!g && v) {
return s;
}
if (g && t) {
return q;
}
return r;
}
if (n <= o && n <= p) {
if (!g && u) {
return r;
}
return d(i);
}
if (p <= o && p <= n) {
if (g && u) {
return r;
}
return d(j);
}
return Rect.empty;
}
}
VerticalAnchoredCategorySeriesInteractionManager.$t = /*@__PURE__*/ markType(VerticalAnchoredCategorySeriesInteractionManager, 'VerticalAnchoredCategorySeriesInteractionManager', Base.$, [IVerticalAnchoredCategorySeriesInteractionManager_$type]);
return VerticalAnchoredCategorySeriesInteractionManager;
})();