How druid.scroll works: View nodes, Content nodes, and Inertia
masterThe druid.scroll component manages the relationship between a static viewport and dynamic content.
Core Concepts
- View Node vs. Content Node: The
view_nodeis the static part that captures input. Thecontent_nodeis the dynamic part that moves. - Inertia: By default, the scroll style includes inertia and an extra size for a stretching effect.
- Points of Interest: You can set specific points that the scroll system will attempt to center on when scrolling.
- Multitouch: The component requires multitouch and correctly handles
touch_idswaps during dragging.
Scroll Events
You can assign callbacks to these fields to react to scroll actions:
on_scroll(self, position): Triggered during a scroll move.on_scroll_to(self, position, is_instant): Triggered when ascroll_tofunction is called.on_point_scroll(self, item_index, position): Triggered whenscroll_to_indexis called.