igniteui-react-core
Version:
Ignite UI React Core.
139 lines (138 loc) • 5.62 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 { CollisionGeometry } from "./CollisionGeometry";
import { CollisionRect } from "./CollisionRect";
import { Point_$type, markType } from "./type";
import { GeometryUtil } from "./GeometryUtil";
/**
* @hidden
*/
export let PieSliceCollisionGeometry = /*@__PURE__*/ (() => {
class PieSliceCollisionGeometry extends CollisionGeometry {
get_type() {
return 2;
}
get type() {
return this.get_type();
}
get centerX() {
return this.k;
}
get centerY() {
return this.l;
}
get radius() {
return this.o;
}
get startAngle() {
return this.p;
}
get endAngle() {
return this.m;
}
constructor(a, b, c, d, e, f) {
super();
this.k = 0;
this.l = 0;
this.o = 0;
this.p = 0;
this.m = 0;
this.g = CollisionRect.empty;
this.n = 0;
this.k = a;
this.l = b;
this.p = e;
this.m = f;
this.o = c;
this.n = d;
}
get_boundingBox() {
if (this.g.isEmpty) {
let a = GeometryUtil.y({ $type: Point_$type, x: this.k, y: this.l }, this.p, this.m, this.o);
this.g = new CollisionRect(0, a);
}
return this.g;
}
get boundingBox() {
return this.get_boundingBox();
}
get innerRadius() {
return this.n;
}
d(a) {
let b = { $type: Point_$type, x: a.left, y: a.top };
let c = { $type: Point_$type, x: a.right, y: a.top };
let d = { $type: Point_$type, x: a.right, y: a.bottom };
let e = { $type: Point_$type, x: a.left, y: a.bottom };
let f = { $type: Point_$type, x: this.k, y: this.l };
let g = this.o;
let h = this.n;
if (GeometryUtil.f(b, f, this.p, this.m, g, h) || GeometryUtil.f(c, f, this.p, this.m, g, h) || GeometryUtil.f(d, f, this.p, this.m, g, h) || GeometryUtil.f(e, f, this.p, this.m, g, h)) {
return true;
}
return false;
}
collidesWithHeavy(a) {
if (!this.boundingBox.intersectsWith(a)) {
return false;
}
return this.collidesWithCoreHeavy(a);
}
collidesWithCoreHeavy(a) {
if (this.d(a)) {
return true;
}
let b = { $type: Point_$type, x: a.left, y: a.top };
let c = { $type: Point_$type, x: a.right, y: a.top };
let d = { $type: Point_$type, x: a.right, y: a.bottom };
let e = { $type: Point_$type, x: a.left, y: a.bottom };
let f = { $type: Point_$type, x: this.k + this.n * Math.cos((this.m + this.p) / 2), y: this.l + this.n * Math.sin((this.m + this.p) / 2) };
if (f.x < a.right && f.x > a.left && f.y < a.bottom && f.y > a.top) {
return true;
}
if (this.h(b, c, this.o) || this.h(b, e, this.o) || this.h(d, c, this.o) || this.h(e, d, this.o)) {
return true;
}
if (this.h(b, c, this.n) || this.h(b, e, this.n) || this.h(d, c, this.n) || this.h(e, d, this.n)) {
return true;
}
let g = Math.cos(this.p);
let h = Math.sin(this.p);
let i = Math.cos(this.m);
let j = Math.sin(this.m);
let k = { $type: Point_$type, x: this.k + this.n * g, y: this.l + this.n * h };
let l = { $type: Point_$type, x: this.k + this.o * g, y: this.l + this.o * h };
let m = { $type: Point_$type, x: this.k + this.n * i, y: this.l + this.n * j };
let n = { $type: Point_$type, x: this.k + this.o * i, y: this.l + this.o * j };
if (GeometryUtil.a(k, l, b, c) || GeometryUtil.a(k, l, b, e) || GeometryUtil.a(k, l, d, c) || GeometryUtil.a(k, l, e, d)) {
return true;
}
if (GeometryUtil.a(m, n, b, c) || GeometryUtil.a(m, n, b, e) || GeometryUtil.a(m, n, d, c) || GeometryUtil.a(m, n, e, d)) {
return true;
}
return false;
}
h(a, b, c) {
let d = { $type: Point_$type, x: this.k, y: this.l };
let e, f;
let g = ((() => { let h = GeometryUtil.p(this.k, this.l, c, a, b, e, f); e = h.p5; f = h.p6; return h.ret; })());
if (g > 0) {
if (GeometryUtil.b(GeometryUtil.j(d, e), this.p, this.m)) {
return true;
}
}
if (g > 1) {
if (GeometryUtil.b(GeometryUtil.j(d, f), this.p, this.m)) {
return true;
}
}
return false;
}
}
PieSliceCollisionGeometry.$t = /*@__PURE__*/ markType(PieSliceCollisionGeometry, 'PieSliceCollisionGeometry', CollisionGeometry.$);
return PieSliceCollisionGeometry;
})();