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 center option for scrollToAlignment #252

Merged
merged 3 commits into from May 23, 2016

Conversation

edulan
Copy link
Contributor

@edulan edulan commented May 23, 2016

Adds "center" option to scrollToAlignment for being able to scroll to a cell and display it centered on the container.

This is specially useful when scrolling horizontally and want to show a given cell in the middle of the screen (in our use case is the today column in a gantt chart)

// 100 rows * 20 item height = 2,000 total item height
// We first scroll past the specified cell and then back.
// The minimum amount of scrolling then should leave the specified cell in the middle (just scrolled into view).
// Since alignment is set to "middle" we should scroll past this point until the cell is aligned center.
Copy link
Owner

Choose a reason for hiding this comment

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

"center" (not "middle")

@bvaughn
Copy link
Owner

bvaughn commented May 23, 2016

Nice update! Thanks for the PR. Left some small comments.

Docs will also need to be updated (but I can do that if you'd prefer to just focus on the code.)

@edulan
Copy link
Contributor Author

edulan commented May 23, 2016

Thanks @bvaughn. I'll take care of the docs too 😉

@andresgutgon
Copy link

📯 👍

@bvaughn
Copy link
Owner

bvaughn commented May 23, 2016

Thanks for putting together this PR :)

@bvaughn bvaughn merged commit 0aa7982 into bvaughn:master May 23, 2016
@bvaughn
Copy link
Owner

bvaughn commented May 23, 2016

Version 7.1.2 just released with this feature.

@edulan
Copy link
Contributor Author

edulan commented May 23, 2016

Thank you so much @bvaughn for being so fast 🚀!

The work you're doing with react-virtualized is totally awesome.

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