A number of underlying problems with hex grid have been fixed:
The edge projection was not updated when the cell dimensions were changed, leading to all sorts of discrepancies the more the grid is modified. Now it is always updated when dimensions change.
The math in a few places assumed a scaled version of a regular hex while other places assumed an equal edge length. These can't generally be true at the same time, which caused some graphical inaccuracies as well as #2840. These places have now been generalized to work for any shape hex, and we have also committed to not using equal-length edges since it has its own subtleties.
The shape cache for hex grids was not being cleared when the grid changed, leading to some odd artifacts depending on when the cache was populated (#4830).
With the above, whatever the users sets in the "2nd Size" input is kept and is reflected in the map. Previously, typing in 100 x 400 would change the second size and result in this:
Now the 400 is kept and we see this:
Some general grid clean up is included as well:
Grids, and especially hex grids, used to serialize way too much. Most of the fields are now transient, with only size, offset, and for hex grids also their "aspect ratio" and orientation being serialized. The DTOs now include only these fields as well.
Hex grid shapes are now built as a Path2D and filled in as an Area instead of merging together a bunch of individual cells. This avoids precision issues (gaps) without needing to scale up the cell size. It avoids any possibility of holes in the result, and avoids hex grid lights bleeding over the cell edges.
The way grid offsets work for hex grids is a little different now. For some reason we were offseting by more than a cell size only for other code to compensate for that. Now we offset by only a fraction of a cell.
Possible Drawbacks
If loading an existing campaign with really stretched out hex grids, snap-to-grid tokens will not end up in the same cell as before. Since the cell dimensions were not accurate before, the conversion between a tokens real position and its cell has changed.
Documentation Notes
N/A
Release Notes
Fixed a bug where the 2nd Size for hex grids would not remain as the user set it.
Fixed a bug where grid lights on adjusted hex grids could contain gaps.
Identify the Bug or Feature request
Fixes #2840 Fixes #4830
Description of the Change
A number of underlying problems with hex grid have been fixed:
With the above, whatever the users sets in the "2nd Size" input is kept and is reflected in the map. Previously, typing in 100 x 400 would change the second size and result in this: Now the 400 is kept and we see this:
Some general grid clean up is included as well:
transient
, with only size, offset, and for hex grids also their "aspect ratio" and orientation being serialized. The DTOs now include only these fields as well.Path2D
and filled in as anArea
instead of merging together a bunch of individual cells. This avoids precision issues (gaps) without needing to scale up the cell size. It avoids any possibility of holes in the result, and avoids hex grid lights bleeding over the cell edges.Possible Drawbacks
If loading an existing campaign with really stretched out hex grids, snap-to-grid tokens will not end up in the same cell as before. Since the cell dimensions were not accurate before, the conversion between a tokens real position and its cell has changed.
Documentation Notes
N/A
Release Notes
This change is