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

Manipulation API: Best method for highlighting #392

Closed
jacobwindsor opened this issue Apr 12, 2017 · 1 comment
Closed

Manipulation API: Best method for highlighting #392

jacobwindsor opened this issue Apr 12, 2017 · 1 comment

Comments

@jacobwindsor
Copy link
Member

Currently, the parameters for highlight functions (toggleHighlight, highlightOn and highlightOff) are like this:

toggleHighlight(entities: string | string[], color: string, resets?: {object containing resets})

This means that if you want to highlight three nodes three different colours you have to fire the function three times.

Alternatively, it could be changed to:

toggleHighlight(nodeColorMap: {entityId: string, color: string}[], resets?: {object containing resets})

This would allow you to toggle the highlighting of three different entities with different colours in one call.

Thoughts

  • Both the alternative and repetitions of the current method achieve the same thing. Neither offers more control.
  • The alternative method is (slightly) more verbose.
  • The alternative method allow syntax like in the method of the CSS-like syntax in this comment
  • We don't really need to offer support to highlight multiple entities at once. We can just do:
toggleHighlight(entities: string, color: string, resets?: {object containing resets})
  • zoomOn and panTo of multiple nodes at once is crucial since it needs to compute the center point of all of them. However, you can just call toggleHighlight() multiple times for each entity.

Is it really necessary to highlight multiple entities in one call? If so, then we really need to decide on one method. If we stick with the current method then we need to document that to achieve highlighting of multiple nodes with different colors, you must call the method multiple times.

@jacobwindsor
Copy link
Member Author

All highlight methods now have a significantly reduced arity. Only two parameters are required:

toggleHighlight(node_id: string, color: string)

The methods do not accept list of node_ids

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

No branches or pull requests

1 participant