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

Graph: Supporting custom functions for node rendering; onRenderComplete callback #404

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rokotyan
Copy link
Contributor

This PR will allow the users to come up with their own node rendering functions, which will be a pretty common use case for everyone designing their own graphs.

It also add the onRenderComplete callback which allows you to do even more, e.g. add custom background / foreground graphics.

Screen.Recording.2024-06-20.at.3.32.51.PM.mp4

@rokotyan rokotyan force-pushed the graph/custom-rendering branch 2 times, most recently from 10ff245 to e6c07c2 Compare June 27, 2024 22:56
Copy link
Collaborator

@reb-dev reb-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments. Other than those everything looks good!

packages/ts/src/components/graph/index.ts Outdated Show resolved Hide resolved
packages/ts/src/components/graph/modules/node/label.ts Outdated Show resolved Hide resolved
@lee00678
Copy link
Collaborator

lee00678 commented Jul 9, 2024

Do we need to add documentation for this?

@rokotyan
Copy link
Contributor Author

rokotyan commented Jul 9, 2024

@lee00678 Yes, definitely. And probably a new example. I feel like it's a pretty big feature so we might want to present it properly.

@rokotyan
Copy link
Contributor Author

Latest commits summary:

Reworking node selection and state update logic

  • New Config property: nodeSelectionHighlightMode to control what to dim / highlight on node selection
  • Fix: Node and link state was set after render
  • Refactor: Removed unnecessary render calls
  • Refactor: Renamed state-related rendering functions (updateNodesPartial, updateLinksPartial)

@rokotyan rokotyan marked this pull request as ready for review July 18, 2024 22:44
@rokotyan
Copy link
Contributor Author

@reb-dev (cc @lee00678) After some more local testing, I think I need to make the updateNodesPartial function configurable as well. Otherwise some of the styles might get overridden. Also to give you a heads up, I might need to move the logic around using s.nodeSelectors.brushed class there because it aligns better with what we have for grayed out and selected states.

@rokotyan rokotyan marked this pull request as draft July 24, 2024 23:49
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

Successfully merging this pull request may close these issues.

None yet

3 participants