flauwekeul/honeycomb

Second grid overriding original Hex factory

retrotheft opened this issue · 2 comments

Hey man, I've been using Honeycomb for the last month, and I absolutely love it, you've done a really good job. Sadly though I've run into a problem that's taken up my whole day with no solution, so I figured I'd pop in and ask.

I've been implementing a system to store hexes in a grid inside hexes of another grid, which will be at a different 'zoom' level (so for instance 7 hexagons might be inside 1 hexagon in the grid 1 zoom level up). Basically it's just an implementation of this Sander Evans page,. which you've probably seen since I found it from the Red Blob Gaming page. https://observablehq.com/@sanderevers/hexagon-tiling-of-an-hexagonal-grid

One thing to note here is that if the first grid is "pointy," then the second one should be "flat" if you don't want things to rotate around when zooming.

The problem I've arrived at though is that when I create the second grid, its Hex factory overrides the initial hex factory, so that my first pointy grid is now using flat hex assumptions in its operations, even though originally it was created with a pointy Hex factory.

It's worth noting that since defineGrid doesn't take properties in the same way that extendHex does, I ended up writing my own mixin so that I can put some more methods onto the prototype. So it's possible that the issue is entirely in my code and nothing to do with Honeycomb, but I honestly can't tell at this point so I figured I'd ask if what I'm describing sounds like normal behaviour for Honeycomb to you, and if you might be able to shed some light on what's happening.

Thanks for taking the time, and again, awesome job :D

So, even though I spent hours on this today, immediately after writing this comment I managed to confirm that it's definitely in my code as I've just created a second grid in a simpler way and it didn't mess the original up. Move along, nothing to see here. Just a dude in need of a rubber duck.

Haha, that's cool man 😉 Thanks for the compliments, I appreciate it. Let me know if you have any more questions or need a rubber duck 🦆