pub trait ScrollDataSource {
// Required method
fn get_offset(&self, node_id: NodeId) -> f32;
}Expand description
A source of scroll offsets for scroll containers.
The layout engine calls get_offset for each
LayoutOp::Scroll node to learn how far the user has scrolled. Platform
backends implement this trait (or pass a closure, which also implements it).
§Example
use fission_layout::ScrollDataSource;
use fission_ir::NodeId;
// A closure works as a ScrollDataSource:
let source = |_node: NodeId| -> f32 { 0.0 };
assert_eq!(source.get_offset(NodeId::explicit("scroll")), 0.0);Required Methods§
Sourcefn get_offset(&self, node_id: NodeId) -> f32
fn get_offset(&self, node_id: NodeId) -> f32
Returns the current scroll offset for the given scroll container node.