igniteui-react-core
Version:
Ignite UI React Core.
174 lines (173 loc) • 6.87 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 } from "tslib";
import { CollisionGeometry } from "./CollisionGeometry";
import { CollisionRect } from "./CollisionRect";
import { Point_$type, markType } from "./type";
import { GeometryUtil } from "./GeometryUtil";
/**
* @hidden
*/
var PieSliceCollisionGeometry = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(PieSliceCollisionGeometry, _super);
function PieSliceCollisionGeometry(a, b, c, d, e, f) {
var _this = _super.call(this) || this;
_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;
return _this;
}
PieSliceCollisionGeometry.prototype.get_type = function () {
return 2;
};
Object.defineProperty(PieSliceCollisionGeometry.prototype, "type", {
get: function () {
return this.get_type();
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "centerX", {
get: function () {
return this.k;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "centerY", {
get: function () {
return this.l;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "radius", {
get: function () {
return this.o;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "startAngle", {
get: function () {
return this.p;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "endAngle", {
get: function () {
return this.m;
},
enumerable: false,
configurable: true
});
PieSliceCollisionGeometry.prototype.get_boundingBox = function () {
if (this.g.isEmpty) {
var 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;
};
Object.defineProperty(PieSliceCollisionGeometry.prototype, "boundingBox", {
get: function () {
return this.get_boundingBox();
},
enumerable: false,
configurable: true
});
Object.defineProperty(PieSliceCollisionGeometry.prototype, "innerRadius", {
get: function () {
return this.n;
},
enumerable: false,
configurable: true
});
PieSliceCollisionGeometry.prototype.d = function (a) {
var b = { $type: Point_$type, x: a.left, y: a.top };
var c = { $type: Point_$type, x: a.right, y: a.top };
var d = { $type: Point_$type, x: a.right, y: a.bottom };
var e = { $type: Point_$type, x: a.left, y: a.bottom };
var f = { $type: Point_$type, x: this.k, y: this.l };
var g = this.o;
var 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;
};
PieSliceCollisionGeometry.prototype.collidesWithHeavy = function (a) {
if (!this.boundingBox.intersectsWith(a)) {
return false;
}
return this.collidesWithCoreHeavy(a);
};
PieSliceCollisionGeometry.prototype.collidesWithCoreHeavy = function (a) {
if (this.d(a)) {
return true;
}
var b = { $type: Point_$type, x: a.left, y: a.top };
var c = { $type: Point_$type, x: a.right, y: a.top };
var d = { $type: Point_$type, x: a.right, y: a.bottom };
var e = { $type: Point_$type, x: a.left, y: a.bottom };
var 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;
}
var g = Math.cos(this.p);
var h = Math.sin(this.p);
var i = Math.cos(this.m);
var j = Math.sin(this.m);
var k = { $type: Point_$type, x: this.k + this.n * g, y: this.l + this.n * h };
var l = { $type: Point_$type, x: this.k + this.o * g, y: this.l + this.o * h };
var m = { $type: Point_$type, x: this.k + this.n * i, y: this.l + this.n * j };
var 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;
};
PieSliceCollisionGeometry.prototype.h = function (a, b, c) {
var _this = this;
var d = { $type: Point_$type, x: this.k, y: this.l };
var e, f;
var g = ((function () { var 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 = markType(PieSliceCollisionGeometry, 'PieSliceCollisionGeometry', CollisionGeometry.$);
return PieSliceCollisionGeometry;
}(CollisionGeometry));
export { PieSliceCollisionGeometry };