Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VScroller ¶
func VScroller(props VScrollerProps) *dom.Node
VScroller creates a vertical scrolling container that shows a sliding window of children starting from BeginIndex and fitting within the specified Height. It includes headers at the top and bottom indicating items outside the visible area. The SelectedIndex ensures the selected item is always visible.
Types ¶
type SliceVerticalResult ¶
type SliceVerticalResult struct {
BeginIndex int // The begin index (inclusive) for slicing
EndIndex int // The end index (exclusive) for slicing
ShowTopIndicator bool // Whether to show "items above" indicator
ShowBottomIndicator bool // Whether to show "items below" indicator
ItemsAbove int // Number of items above the visible range
ItemsBelow int // Number of items below the visible range
}
SliceVerticalResult contains the result of vertical slicing calculation
func SliceVertical ¶
func SliceVertical(nodes []*dom.Node, selectedIndex int, height int, sliceStart int) SliceVerticalResult
SliceVertical calculates which nodes fit within the given height, accounting for scroll indicators. It returns a struct with all the information needed to render the visible portion with indicators. The function automatically reserves space for top/bottom indicators when needed.
Parameters:
- nodes: The list of all nodes
- selectedIndex: The currently selected item index (must be visible)
- height: The total available height
- sliceStart: Current slice start position (preserves window frame, 0 if unknown)
The function ensures selectedIndex is visible, adjusting the visible window as needed. It uses sliceStart as the initial beginIndex to preserve the window position.