You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a residence hex grid user I was tracking down odd snapping behavior of template on hex grids. It looks like the get snappingMode function in MeasuredTemplatePF2e is written with the expectation that it is called from a square grid but it can also be called from a hex grid via the chat message button. As far as I can tell it still can't be called from gridless.
if (canvas.grid.isSquare) {
switch (this.areaShape) {
case "burst":
return M.CORNER;
case "emanation":
return M.CENTER;
case "cone":
return M.CENTER | M.CORNER | M.SIDE_MIDPOINT;
case "line":
return M.SIDE_MIDPOINT | M.CORNER;
default:
return M.CENTER | M.CORNER;
}
}
if (canvas.grid.isHexagonal) {
switch (this.areaShape) {
case "burst":
return M.VERTEX;
case "emanation":
return M.CENTER;
case "cone":
return M.CENTER | M.VERTEX;
case "line":
return M.CENTER;
default:
return M.CENTER | M.VERTEX;
}
}
(I'll admit that I have left the "cone" to the default of M.CENTER | M.VERTEX as I do not know if a more restrictive set of modes would be cleaner for hex grids)
Additionally with the snappingMode working on hex grids the following code:
FolkvangrForgent
changed the title
[BUG] MeasuredTemplatePF2e get snappingMode return incorrect snapmodes on Hex Grid
[BUG] MeasuredTemplatePF2e get snappingMode returns incorrect snapmodes on Hex Grid
Jul 28, 2024
As another suggestion of code cleanup the function hasHexGrid that is part of ScenePF2e is redundant with the new isHexagonal grid flag. The following code can be removed:
As a residence hex grid user I was tracking down odd snapping behavior of template on hex grids. It looks like the
get snappingMode
function inMeasuredTemplatePF2e
is written with the expectation that it is called from a square grid but it can also be called from a hex grid via the chat message button. As far as I can tell it still can't be called from gridless.I would suggest replacing the current code:
pf2e/src/module/canvas/measured-template.ts
Lines 34 to 45 in 6e63427
with something like the following code:
(I'll admit that I have left the
"cone"
to the default ofM.CENTER | M.VERTEX
as I do not know if a more restrictive set of modes would be cleaner for hex grids)Additionally with the
snappingMode
working on hex grids the following code:pf2e/src/module/canvas/layer/template.ts
Line 19 in 6e63427
can be changed to:
I will lastly note that there is a current MR #15552 that add more square grid dependent logic.
The text was updated successfully, but these errors were encountered: