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

Add fit to node canvas util #258

Merged
merged 6 commits into from
Jul 11, 2024
Merged

Add fit to node canvas util #258

merged 6 commits into from
Jul 11, 2024

Conversation

ghsteff
Copy link
Contributor

@ghsteff ghsteff commented Jul 8, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

There's no way to fit / focus the view on a specific node, only on the entire canvas

What is the new behavior?

use fitToNode() from CanvasRef to zoom and center the viewport on a specific node

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Screen.Recording.2024-07-08.at.4.18.39.PM.mov
Screen.Recording.2024-07-08.at.4.13.22.PM.mov

Copy link

vercel bot commented Jul 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reaflow ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2024 6:28pm

Copy link

netlify bot commented Jul 8, 2024

Deploy Preview for reaflow ready!

Name Link
🔨 Latest commit 6b12951
🔍 Latest deploy log https://app.netlify.com/sites/reaflow/deploys/668ed2a5717d170008d30b81
😎 Deploy Preview https://deploy-preview-258--reaflow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ghsteff ghsteff requested a review from amcdnl July 8, 2024 20:34
docs/Advanced/Refs.mdx Outdated Show resolved Hide resolved
docs/Advanced/Refs.mdx Outdated Show resolved Hide resolved
src/layout/useLayout.ts Outdated Show resolved Hide resolved
docs/Advanced/Refs.mdx Show resolved Hide resolved
docs/Advanced/Refs.mdx Outdated Show resolved Hide resolved
return [scrollX, scrollY];
};

export const getNodesBoundingBox = (nodes: LayoutNodeData[]) => {
Copy link
Member

Choose a reason for hiding this comment

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

I would add some comments here.

Copy link
Member

@amcdnl amcdnl left a comment

Choose a reason for hiding this comment

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

looks great - one minor tweak to api and its good to go

@amcdnl amcdnl merged commit 981f99c into master Jul 11, 2024
7 checks passed
@amcdnl amcdnl deleted the Add-fit-to-node branch July 11, 2024 11:11
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.

2 participants