-
I am rendering out a large amount of text. I've split it into chapters right now (the text itself comes in sentences, but since the items have to be block based when styling and calculating offsets, it makes more sense to render as chapters). I want the ability to scroll to specific sentences though. Currently, I scrollToIndex, wait for the The problem with this is there's a slight flash between scrolling to the chapter and then scrolling back down to the verse. Another problem is that sometimes, the chapter is already visible, so calling |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Here's an example using the svelte playground that illustrates the flash to make scrolling within an item necessary: https://svelte.dev/playground/739fe48421134ba1b6a6ab9c8247f9c9?version=5.1.13 |
Beta Was this translation helpful? Give feedback.
This seems to work without the opacity and scrollend controll, as far as I tested. scrollToIndex will be completed without repaint, so you can schedule it again with sentence.offsetTop just before paint.
There are no good API to wait for scrollToIndex ends for now. I may change scrollToIndex to return promise to wait f…