Closed flauwekeul closed 3 years ago
I'll try to come back to this later today.
Thank you! I really appreciate it!
Take your time. I'm just messing around with the library on a small hobby project.
You found something I hadn't thought of yet (again), so that's very valuable 👍
I've changed update()
so that it always returns a grid that iterates over the hexes in its store. I think it's what people (like yourself) would expect.
This demonstrates the changed behaviour:
const sourceGrid = new Grid(hexPrototype, rectangle({ width: 2, height: 1 }))
const updatedGrid = sourceGrid.update((grid) => {
grid.store = new Map()
})
sourceGrid
.each((hex) => console.log(hex)) // Hex {q: 0, r: 0}, Hex {q: 1, r: 0}
.run()
updatedGrid
.each((hex) => console.log(hex)) // won't be called, because the store is empty
.run()
I'll release this in the next alpha.
:tada: This issue has been resolved in version 4.0.0-beta.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Here's another grid bug that I just encountered:
I tried updating a hex as per the readme instructions, using
grid.update()
and within theupdate()
method I calledgrid.store.set()
. This works, if you're callinggrid.store.get()
to get the new hex. However, if you try usinggrid.each()
, you get the old hex returned.Originally posted by @vfonic in https://github.com/flauwekeul/honeycomb/issues/67#issuecomment-812941221