initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
shadow$provide.module$node_modules$pixi_DOT_js$lib$maths$shapes$Ellipse = function(global, require, module, exports) {
|
||||
var Rectangle = require("module$node_modules$pixi_DOT_js$lib$maths$shapes$Rectangle");
|
||||
"use strict";
|
||||
class Ellipse {
|
||||
constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0) {
|
||||
this.type = "ellipse";
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.halfWidth = halfWidth;
|
||||
this.halfHeight = halfHeight;
|
||||
}
|
||||
clone() {
|
||||
return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);
|
||||
}
|
||||
contains(x, y) {
|
||||
if (0 >= this.halfWidth || 0 >= this.halfHeight) {
|
||||
return !1;
|
||||
}
|
||||
x = (x - this.x) / this.halfWidth;
|
||||
y = (y - this.y) / this.halfHeight;
|
||||
return 1 >= x * x + y * y;
|
||||
}
|
||||
strokeContains(x, y, strokeWidth, alignment = 0.5) {
|
||||
const {halfWidth, halfHeight} = this;
|
||||
if (0 >= halfWidth || 0 >= halfHeight) {
|
||||
return !1;
|
||||
}
|
||||
var strokeOuterWidth = strokeWidth * (1 - alignment);
|
||||
alignment = strokeWidth - strokeOuterWidth;
|
||||
strokeWidth = halfWidth - alignment;
|
||||
alignment = halfHeight - alignment;
|
||||
const outerHorizontal = halfWidth + strokeOuterWidth;
|
||||
strokeOuterWidth = halfHeight + strokeOuterWidth;
|
||||
x -= this.x;
|
||||
y -= this.y;
|
||||
return 1 < x * x / (strokeWidth * strokeWidth) + y * y / (alignment * alignment) && 1 >= x * x / (outerHorizontal * outerHorizontal) + y * y / (strokeOuterWidth * strokeOuterWidth);
|
||||
}
|
||||
getBounds(out) {
|
||||
out || (out = new Rectangle.Rectangle());
|
||||
out.x = this.x - this.halfWidth;
|
||||
out.y = this.y - this.halfHeight;
|
||||
out.width = 2 * this.halfWidth;
|
||||
out.height = 2 * this.halfHeight;
|
||||
return out;
|
||||
}
|
||||
copyFrom(ellipse) {
|
||||
this.x = ellipse.x;
|
||||
this.y = ellipse.y;
|
||||
this.halfWidth = ellipse.halfWidth;
|
||||
this.halfHeight = ellipse.halfHeight;
|
||||
return this;
|
||||
}
|
||||
copyTo(ellipse) {
|
||||
ellipse.copyFrom(this);
|
||||
return ellipse;
|
||||
}
|
||||
toString() {
|
||||
return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;
|
||||
}
|
||||
}
|
||||
exports.Ellipse = Ellipse;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$maths$shapes$Ellipse.js.map
|
||||
Reference in New Issue
Block a user