-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make a selected node the center of the page #103
Comments
Hi @mabreyes, thank you for opening this issue. Someone from the team will pick this up and take a look at it |
Hey @mabreyes , thanks to hints from @tonilastre in #52, I've crafted this function which does just what you're talking about I think - you just have to call it with the selected node: https://gist.github.com/josiahbryan/354a0357dd52e43b14b3df4022267b9f I use it like this in my app: const nodeIdForFocus = 'aidgno_ticss4ego8hzw5tx3ov9sdz9b';
const orbNode = orb.data
.getNodes()
.find((x) => x.id === nodeIdForFocus);
if (orbNode) {
orbFocusOnNode(orb, orbNode);
} |
Thanks @josiahbryan is this before the render or after the render? |
I do it after the render... Sorry I should have said that.
…On Sat, May 25, 2024, 2:35 PM Marc Reyes ***@***.***> wrote:
Thanks @josiahbryan <https://github.com/josiahbryan> is this before the
render or after the render?
—
Reply to this email directly, view it on GitHub
<#103 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABEZELEMMZATT23CW4SQ6RLZEDRWZAVCNFSM6AAAAABIDKPH4KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZRGQYTGOBSHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Got it to work and I was also able to make it change based on the search query. Thanks @josiahbryan |
@josiahbryan thanks for jumping in with a great solution. We are preparing a 1.0.0 version of the Orb that will have some changes to the API (e.g. render will be called automatically) along with several performance fixes. We added Our plan after 1.0.0 was to fix the default layout algo (d3-force) and also expose layout algorithms where you will be able to plug in any other layout (e.g. tree layout), but adding this feature before that makes more sense. |
Thanks @tonilastre - will the 1.0.0 "break" any of the APIs I used in this "hack"? Or will this still work on 1.0.0 (before you add it to the official API)? |
The main part of the code (90% of it) will work as is, there will be some minor changes, e.g. All in all, it is just a simple find+replace on some of the classes and functions. We will create a guided migration document for it to help out with the transition. |
Ahh nice!! Love to hear there will be a migration doc - thanks for the quick response and appreciate your detailed reply. Looking forward to trying out 1.0.0 - yeah I was noticing some less-than-optimal rendering on a few of my screens (quad-monitor setup) - so looking forward to the DPR enhancements too. Thanks! |
How do I make a selected node the center of the graph? In my code below, the
selectedNode
holds the value of the node. How do I get its coordinates and refresh the graph with theselectedNode
as the center?Thank you!
The text was updated successfully, but these errors were encountered: