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

Node is not clickable or responding to any mouseevent if corresponding node object has 'val' property #55

Closed
wunaidage opened this issue Sep 15, 2019 · 3 comments
Assignees

Comments

@wunaidage
Copy link

wunaidage commented Sep 15, 2019

Describe the bug
Node is not clickable or response to any mouse event if corresponding node object has 'val' property. Using such graph data, if by default, the node will not be drawn. if use nodecanvasobject function, customized things will be drawn but not clickable.

To Reproduce
Steps to reproduce the behavior:
Go to any example, add val property to any node in the graph data

see jsfiddle: https://jsfiddle.net/0b16jmkq/4/

Additional context
the type definition lib: @types/force-graph has a GraphNode type which takes node associated data as 'val', this could be really buggy for the graph and make ppl (like me) debugging why the click is not working for 6 hours.

@vasturiano
Copy link
Owner

@wunaidage in regular drawing mode, the size of a node is determined by the nodeVal property, which defaults to the val attribute in each node's data.
The nodeVal property also determines the area used for click/hover interactions when doing customly drawn nodes using nodeCanvasObject.

If the val attributes in your data set represent anything else other than node sizes, it's recommended to modify this property via f.e. .nodeVal(node => /* your code */), to not interfere with the node sizes and/or pointer interactions.

@vasturiano vasturiano self-assigned this Sep 17, 2019
@wunaidage
Copy link
Author

wunaidage commented Sep 18, 2019

@vasturiano thank you for the clarification. It is really confusing since the document said nodeVal has a default value of val for which I though was a string value, but in fact another property of the node object

@vasturiano
Copy link
Owner

@wunaidage I'm glad it's clear now. This is how all the accessor methods in the library work. They accept, in increasing levels of customization, either a constant, an object attribute or a function. This is to allow varying degrees of flexibility when configuring the component.

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