Hellenic / react-hexgrid

Build interactive hexagon grids with React
https://hellenic.github.io/react-hexgrid/examples/
MIT License
314 stars 128 forks source link

Refactor calculate coordinates function #89

Closed parkerbjur closed 2 years ago

parkerbjur commented 2 years ago

I have refactored calculateCoordinates function to make it a bit simpler. I also added the ability to define an arbitrary rotation angle. Currently I just pass 0 rad or pi/6 rad to do the "flat" or "pointy" hexes.

parkerbjur commented 2 years ago

@tieje hey, here is the change that I was talking about. passed all tests which have coverage.

tieje commented 2 years ago

Thanks for the documentation. All checks have passed. However, do you mind writing a test for the calculateCoordinates function since that's the one that was changed?

parkerbjur commented 2 years ago

Ya, I can write a test for it. Do you want me to submit that as a separate PR or resubmit it all together?

tieje commented 2 years ago

All together is fine.

On Tue, Jul 19, 2022, 5:29 PM Parker Bjur @.***> wrote:

Ya, I can write a test for it. Do you want me to submit that as a separate PR or resubmit it all together?

— Reply to this email directly, view it on GitHub https://github.com/Hellenic/react-hexgrid/pull/89#issuecomment-1189569171, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYP5FKPQORMHOG4KHA7WZ3VU4M2RANCNFSM54A7N7XA . You are receiving this because you were mentioned.Message ID: @.***>

tieje commented 2 years ago

per our discord discussion for record-keeping: "I'm going to accept your PR. When I last made my suggestion for testing, I didn't really know how testing occurred for Layout yet. It's just refactoring and getting the same output so if the current tests pass, then I think we're in the clear. Though the rewire package (https://github.com/jhnns/rewire) might be helpful for testing private functions. I guess you'll want to make a separate branch for it, if you want to implement testing. I'll put a post in dev discussions about potentially using rewire, since I've never used it."