-
Notifications
You must be signed in to change notification settings - Fork 62
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
grid.neighborsOf #91
Comments
Thanks! 😄 It's been replaced with |
Wow thank you for such a fast response 💓 Just wondering, does I am creating custom hexes with custom data inside, but it seems like when I call neighborOf, it doesn't seem to return the binded data associated to the object. |
To implement export function neighborsOf(grid, hex) {
const east = grid.neighborOf(hex, Direction.E);
const northeast = grid.neighborOf(hex, Direction.NE);
const southeast = grid.neighborOf(hex, Direction.SE);
const west = grid.neighborOf(hex, Direction.W);
const northwest = grid.neighborOf(hex, Direction.NW);
const southwest = grid.neighborOf(hex, Direction.SW);
const neighbors = [east, northeast, southeast, west, northwest, southwest].map(({ q, r }) => {
return grid.getHex([q, r]);
});
return neighbors;
} thank you for your input in advance :) |
Hm, looks like you stumbled on a bug there. Unless you pass For now you can circumvent the bug by doing this (this will return grid.getHex(grid.neighborOf([1,2], Direction.E)) |
Ah I'm glad I could point it out. The previous major version returned the references so I thought I was making a mistake somewhere. Any plans on providing the |
The const neighbors = grid.traverse(ring({ center: [1, 2], radius: 1 })) |
Thank you so much for the pointer! 👍 ❤ |
# [v4.0.1](v4.0.0...v4.0.1) (2022-10-13) ## 🐛 Bug Fixes - [`07af072`](07af072) grid.neighborOf() now uses grid.getHex() primarily (Issues: [`#91`](#91)) ## [4.0.1](v4.0.0...v4.0.1) (2022-10-13)
🎉 This issue has been resolved in version 4.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
First, thank you for this amazing project! :)
Is
grid.neighborsOf
deprecated in v4.0.0?The text was updated successfully, but these errors were encountered: