Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Specify range of items in visible rect for animation #132

Open
KevinDoughty opened this issue Sep 4, 2018 · 5 comments
Open

Specify range of items in visible rect for animation #132

KevinDoughty opened this issue Sep 4, 2018 · 5 comments

Comments

@KevinDoughty
Copy link

To animate items along the scroll axis, while scrolling, there is a need to specify a range of present items other than merely those that intersect the visible rect. I am a proponent of the data source pattern, but I know of no implementations sufficient for this, and I hope you will consider adding this feature. In my own javascript implementation I created a data source method, rangeOfItemsInRect. UITableView fails in this regard, as you can see in this video with exaggerated timing to show the effect:

https://www.youtube.com/watch?v=C1p9qEuMNns

This is not the only use, however. Animating reflow of a grid layout when resizing the viewport from wide to narrow would instantly change the non-animated visible range, which would need to be expanded to include items still animating, much like in the video from this comment:

#64 (comment)

@rakina
Copy link
Member

rakina commented Apr 17, 2019

The new approach for virtual-scroller (detailed in the newly-updated explainer) actually puts all of the content in the DOM now. IIUC, that means this issue should be solved by the new approach already - do you think so?

@KevinDoughty
Copy link
Author

KevinDoughty commented Apr 18, 2019

I have not looked at virtual-scroller in awhile. I am interested in animating lists and grids and my demands are high. Unfortunately, the getters rangeFirst and rangeLast are not quite sufficient. If you and only you control what range of items are rendered, perhaps by viewport intersection, I will not be able to animate other items outside of that range during scrolling or resize. They would be visible because of animation, but only if I could get virtual-scroller to render them.

@rakina
Copy link
Member

rakina commented Apr 19, 2019

Oh, interesting. It might be useful to add a way to say "this child needs to be rendered regardless of its position relative to the viewport". Do you think that would help?

@KevinDoughty
Copy link
Author

Yes! That sounds about right.

@KevinDoughty
Copy link
Author

Here are more examples of animations on scrolling and resize that would break without this feature.

Scrolling of NSTextView and custom grid view in AppKit:
https://twitter.com/KvnDy/status/884525547312877568

Resize of my own windowing/virtual collection view written in javascript. Without this feature, items would instantly disappear when resizing from wide to narrow, right to left:
https://twitter.com/KvnDy/status/775872332028141568

This also shows resize, but highlights why I think your solution for #64 will not be sufficient for grid animation. I will file an issue if I determine this to be the case.
https://twitter.com/KvnDy/status/775142451916988416

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants