Skip to content

Commit

Permalink
Add default behaviour for zero-width beams
Browse files Browse the repository at this point in the history
When getting its shaped area, the width will be forced to be at least one pixel wide.
  • Loading branch information
kwvanderlinde committed Dec 3, 2023
1 parent faeb004 commit c1647af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/rptools/maptool/model/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public Area getShapedArea(
if (token.getFacing() == null) {
token.setFacing(0);
}
var pixelWidth = width * getSize() / zone.getUnitsPerCell();
var pixelWidth = Math.max(1, width * getSize() / zone.getUnitsPerCell());
Shape lineShape = new Rectangle2D.Double(0, -pixelWidth / 2, visionRange, pixelWidth);
Shape visibleShape = new GeneralPath(lineShape);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/rptools/maptool/model/IsometricGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public Area getShapedArea(
if (token.getFacing() == null) {
token.setFacing(0);
}
var pixelWidth = width * getSize() / getZone().getUnitsPerCell();
var pixelWidth = Math.max(1, width * getSize() / getZone().getUnitsPerCell());
Shape visibleShape = new Rectangle2D.Double(0, -pixelWidth / 2, visionRange, pixelWidth);

// new angle, corrected for isometric view
Expand Down

0 comments on commit c1647af

Please sign in to comment.