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

Templates that should be centered on tokens are not when using a hex grid #26

Open
seanpg71 opened this issue Sep 6, 2022 · 0 comments

Comments

@seanpg71
Copy link

seanpg71 commented Sep 6, 2022

I was specifically having issues with Misty Step, but presumably it'll be an issue with anything using this sort of code to try to center something on a square:

x: token.x + canvas.grid.size / 2,
y: token.y + canvas.grid.size / 2, 

Due to the nature of mapping a circle on to a hexagon, the radius isn't ever going to match the range exactly. But currently it's additionally weirdly offset making the range larger on one side of the token than the other.

I switched mine to this which works for my hexagonal rows - but would cause even more even problems for someone using columns:

    x: token.x + canvas.grid.size * (canvas.grid.isHex ? Math.sqrt(3) / 4 : 1 / 2),
    y: token.y + canvas.grid.size / 2,

Didn't see an obvious way to determine row vs columns and that was good enough - but presumably there is one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant