flauwekeul / honeycomb

Create hex grids easily, in node or the browser.
https://abbekeultjes.nl/honeycomb
MIT License
638 stars 59 forks source link

Add image, hover and click on hex ? #38

Closed Azumix closed 5 years ago

Azumix commented 5 years ago

Hello, I don't know if this place is the good one to ask that if not, please forgive me. :) I didn't see any possibilities to add an image on a hex of the grid nor add it hover and click fonctionnalities. Is it possible ?

flauwekeul commented 5 years ago

Hi, this is a good place to start asking questions at least 😉

Honeycomb isn't concerned with what your grid/hexes look like. It's entirely up to you how you render a grid on the screen. Therefore, honeycomb doesn't supply any methods to render grids, you'll have to do that yourself.

For hover and click functionalities, I've made an example before. Rendering an image in a hex strongly depends on how you render hexes.

I can help you with honeycomb related questions, but since rendering is outside honeycomb's scope I suggest you ask rendering-related questions on places like stackoverflow.com.

Azumix commented 5 years ago

Thanks for your answer I'll check that! :)

shmup commented 4 years ago

@flauwekeul This is a really useful example, and there's something funky with newer versions of SVG that doesn't grab the correct hex from the passed in coordinates (in the event listener). I'll update your example code here when (if) I update/fix it.