flauwekeul / honeycomb

Create hex grids easily, in node or the browser.

Home Page:https://abbekeultjes.nl/honeycomb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

t.distance is not a function

arucar opened this issue · comments

Hi everybody
I dont' know if it's an error or if i do something wrong but whith this code i got the error: t.distance is not a function.

const Hex = Honeycomb.extendHex({ size: 30 });
const Grid = Honeycomb.defineGrid(Hex);
const grid = Grid.rectangle({ width: 50, height: 50 });
const hexBetween = grid.hexesBetween({ x: 0, y: 0 }, { x: 5, y: 5 });
console.log(hexBetween);

Someone can say me if it's a problem or where i do a mistake ?

hexesBetween() expects to be called with actual hexes (that have the distance() method), you're calling it with plain objects with x and y properties.

This should fix it:

grid.hexesBetween(Hex(0, 0), Hex(5, 5));

oh i miss that point on the doc.. ok ^^ thank you a lot :)