DVUI

startRow

Return the first row to render (inclusive)

Parameters

#
self:*const VirtualScroller
*const VirtualScroller

Source

Implementation

#
pub fn startRow(self: *const VirtualScroller) usize {
        if (self.grid.row_height < 1) {
            return 0;
        }
        const first_row_in_viewport: usize = @round(self.grid.frame_viewport.y / self.grid.row_height);

        if (first_row_in_viewport == 0 or self.total_rows == 0) {
            return 0;
        }
        return @min(first_row_in_viewport - 1, self.total_rows - 1);
    }