Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tip: You can pass through extra data with your sites coords, that is then in cells sites output. #43

Open
hayden-t opened this issue Jul 2, 2023 · 1 comment

Comments

@hayden-t
Copy link

hayden-t commented Jul 2, 2023

var sites = [ {x: 200, y: 200, specialValue: yes}]

and then that specialValueis now attached in the output of cells when the voronoi is calculated:

diagram.cells[i].site['specialValue']

@Wuzzy2
Copy link

Wuzzy2 commented Oct 26, 2023

This is a bad idea to do it like this because you never know when the API changes and touches your custom value.

JavaScript offers symbols for that use case. https://javascript.info/symbol

Anyway, I think the documentation should mention that the cells sites contain references to your original sites objects, since this is useful to know. Otherwise, you might assumes the cells sites are just copies of those sites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants