Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore circular "unlimited" vision for grid sights #5135

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/main/java/net/rptools/maptool/model/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,8 @@ protected int getTokenFacingAngleRelativeToGridAxis(Token token) {
double arcAngle,
int offsetAngle,
boolean scaleWithToken) {
if (range == 0) {
range = zone.getTokenVisionDistance();
}
double visionRange = range * getSize() / zone.getUnitsPerCell();
double visionRange =
((range == 0) ? zone.getTokenVisionDistance() : range) * getSize() / zone.getUnitsPerCell();

Rectangle footprint = token.getFootprint(this).getBounds(this);

Expand Down Expand Up @@ -852,7 +850,8 @@ private void oneThird(Rectangle regionToDivide, int column, int row, Rectangle d
* Returns an Area with a given radius that is shaped and aligned to the current grid
*
* @param token token which to center the grid area on
* @param range range in units grid area extends out to
* @param range range in units grid area extends out to. if set to {@code 0}, the result will be a
* circular area extending out to {@code visionRange}.
* @param scaleWithToken whether grid area should expand by the size of the token
* @param visionRange token's vision in pixels
* @return the {@link Area} conforming to the current grid layout
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/net/rptools/maptool/model/GridlessGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.rptools.maptool.client.walker.WalkerMetric;
import net.rptools.maptool.server.proto.GridDto;
import net.rptools.maptool.server.proto.GridlessGridDto;
import net.rptools.maptool.util.GraphicsUtil;

public class GridlessGrid extends Grid {
private static List<TokenFootprint> footprintList;
Expand Down Expand Up @@ -198,8 +197,7 @@ public Point2D.Double getCenterOffset() {
protected Area getGridArea(
Token token, double range, boolean scaleWithToken, double visionRange) {
// A grid area isn't well-defined when there is no grid, so fall back to a circle.
return GraphicsUtil.createLineSegmentEllipse(
-visionRange, -visionRange, visionRange, visionRange, CIRCLE_SEGMENTS);
return super.getGridArea(token, 0, scaleWithToken, visionRange);
}

@Override
Expand Down
Loading