jonasgeiler / svelte-tiny-virtual-list

A tiny but mighty list virtualization library for Svelte, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
https://svelte-tiny-virtual-list.jonasgeiler.com
MIT License
405 stars 23 forks source link

Dynamic heights? #13

Closed H4xX0r1337 closed 4 months ago

H4xX0r1337 commented 2 years ago

I tried putting images into the VirtualList. After a bit of tinkering it works, but only until you resize the window. Because the image gets taller when the list gets wider, the VirtualList becomes misaligned. Is there an intended way to fix this or could a feature like this be implemented?

jonasgeiler commented 2 years ago

Would it be possible for you to send me a quick example of your problem on Svelte REPL?

H4xX0r1337 commented 2 years ago

@skayo this is the closest i got https://svelte.dev/repl/5db342ee4e3c4fa4a3405cbcfe617471?version=3.46.4

jonasgeiler commented 2 years ago

Sorry, for the late reply, busy week... Anyways, it looks like the problem is that the function defined in itemSize doesn't get called when the window resizes. The recomputeSizes(index) method is used exactly for this kind of problem.

Here's a working example: https://svelte.dev/repl/54bac5809c9e4570ac11f4d86be4e64c?version=3.46.4 I hope this is what you were looking for.

jonasgeiler commented 2 years ago

Hello again! Did I help solve your issue? I'd like to close this issue.

jonasgeiler commented 4 months ago

Closing this now due to inactivity. Let me know if you need additional help.