Animation on LV_EVENT_SCROLL_END fired twice when snapping


What MCU/Processor/Board and compiler are you using?

x86 desktop using SDL

What LVGL version are you using?


What do you want to achieve?

Fade in a text when a scrolled item finishes snapping.

What have you tried so far?

I’m starting the animation on LV_EVENT_SCROLL_END but that one gets fired twice, once the user lets go of the item and a second time when the auto scrolling finishes snapping.

Is there another event that is fired during the auto snapping? I would like to skip the event when the user lets go of the item and start the animation when the item finishes snapping.

LV_EVENT_SCROLL_BEGIN gets fired twice as well, once the user starts dragging and the second time when auto scrolling starts snapping.

(Answering my own question)
I found a way to distinguish user initiated scroll events from the events that are generated through the automated scrolling animation: The LV_EVENT_SCROLL_BEGIN and LV_EVENT_SCROLL_END events that are fired through snapping carry a pointer to the animation as parameter. So when lv_event_get_param(evt) == NULL, the scroll was initiated by the user.