Skip to content

Commit

Permalink
Fix error re undefined rotate function
Browse files Browse the repository at this point in the history
Requires PIXI.Point. So ensure _generateFixedPoints are PIXI.Points and use PIXI.Point for from/toCartesianCoords.
  • Loading branch information
caewok committed Jul 23, 2024
1 parent 8076c9d commit 1727a65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CenteredPolygon/CenteredPolygonBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class CenteredPolygonBase extends PIXI.Polygon {
*/
fromCartesianCoords(a, outPoint) {
outPoint ??= new PIXI.Point;

a = PIXI.Point._tmp.copyFrom(a);
a.translate(-this.x, -this.y, outPoint).rotate(-this.radians, outPoint);
return outPoint;
}
Expand All @@ -146,7 +146,7 @@ export class CenteredPolygonBase extends PIXI.Polygon {
*/
toCartesianCoords(a, outPoint) {
outPoint ??= new PIXI.Point;

a = PIXI.Point._tmp.copyFrom(a);
a.rotate(this.radians, outPoint).translate(this.x, this.y, outPoint);
return outPoint;
}
Expand Down
8 changes: 4 additions & 4 deletions CenteredPolygon/CenteredRectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ export class CenteredRectangle extends CenteredPolygonBase {
const h1_2 = height * 0.5;

return [
{ x: -w1_2, y: -h1_2 },
{ x: w1_2, y: -h1_2 },
{ x: w1_2, y: h1_2 },
{ x: -w1_2, y: h1_2 }
new PIXI.Point(-w1_2, -h1_2),
new PIXI.Point(w1_2, -h1_2),
new PIXI.Point(w1_2, h1_2),
new PIXI.Point(-w1_2, h1_2)
];
}

Expand Down

0 comments on commit 1727a65

Please sign in to comment.