Skip to content

Commit

Permalink
Fix TokenVBL rotation by incorporating the token anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvanderlinde committed Oct 24, 2024
1 parent 337e332 commit b96eb6f
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ public static Area getTopology_underToken(
final Area topologyUnderToken;
if (token.getShape() == Token.TokenShape.TOP_DOWN && token.getFacingInDegrees() != 0) {
// Get the center of the token bounds
// TODO Incorporate the anchor.
double rx = footprintBounds.getCenterX();
double ry = footprintBounds.getCenterY();
double rx = footprintBounds.getCenterX() - token.getAnchor().x;
double ry = footprintBounds.getCenterY() - token.getAnchor().y;

// Rotate the area to match the token facing
captureArea.rotate(Math.toRadians(token.getFacingInDegrees()), rx, ry);
Expand Down Expand Up @@ -230,9 +229,8 @@ public static Area transformTopology_toToken(Zone zone, Token token, Area topolo

if (token.getShape() == Token.TokenShape.TOP_DOWN && token.getFacingInDegrees() != 0) {
// Get the center of the token bounds
// TODO Incorporate the anchor.
double rx = footprintBounds.getCenterX();
double ry = footprintBounds.getCenterY();
double rx = footprintBounds.getCenterX() - token.getAnchor().x;
double ry = footprintBounds.getCenterY() - token.getAnchor().y;

// Rotate the area to match the token facing
atArea.rotate(-Math.toRadians(token.getFacingInDegrees()), rx, ry);
Expand Down

0 comments on commit b96eb6f

Please sign in to comment.