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 optional coordinate origin to reactFlow.zoomIn() and reactFlow.zoomOut() #4056

Open
huttj opened this issue Mar 21, 2024 · 3 comments
Open
Labels
feature request New feature or request

Comments

@huttj
Copy link

huttj commented Mar 21, 2024

This might be a weird request.

When zooming in and out with the trackpad, it centers around where the mouse pointer is.

When I zoom in with the functions, though, it's just centered around the center of the screen.

In my particular case, I've got the mouse wheel bound to Cmd+= and Cmd+-, which I've added event listeners for, attached to zoomIn and zoomOut. It would be awesome if I could center this around the mouse cursor, as well.

@huttj huttj added the feature request New feature or request label Mar 21, 2024
@moklick
Copy link
Member

moklick commented Mar 27, 2024

Interesting idea :) We will discuss it with the team.

@alessiapacca
Copy link

is there a known workaround for this, right now?

@moklick
Copy link
Member

moklick commented Mar 30, 2024

For now you need to use setViewport https://reactflow.dev/api-reference/types/react-flow-instance#set-viewport

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

No branches or pull requests

3 participants