virtua icon indicating copy to clipboard operation
virtua copied to clipboard

Overscan in px, instead of # of items

Open aeharding opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

In my application, I find myself tweaking overscan depending on item height. I believe that overscan being the # of items to load off screen is limiting in the following ways:

  1. For shorter items, I need a larger overscan so that they don't flicker in as the user outscrolls the render. For very tall items, I need a short overscan.
  2. For VERY large tall items, if I set overscan = 0 I still see a flicker of the item being rendered when I scroll to the next item. So, I set overscan = 1. This works, however when I am very far away from the end of the item, it doesn't make sense to load in the next time until I get closer to the edge.

Describe the solution you'd like

Overscan = px of items to load off screen.

For example, if overscan = 500, then Virtua will load at least 500px of items off the edge of the screen.

This resolves both of my above scenarios.

Describe alternatives you've considered

Adjusting overscan for item size works for problem one but not two.

Additional context

react-virtuoso has this, except it's called increaseViewportBy.

See: https://virtuoso.dev/virtuoso-api-reference/


This may render https://github.com/inokawa/virtua/issues/298 unnecessary, since if it was defined it could just be a static number like 200 px or something.

aeharding avatar Feb 15 '24 03:02 aeharding

Hi, overscan with px sounds nice!

inokawa avatar Feb 15 '24 10:02 inokawa