class Tessell::Widgets::VirtualList

Defined in:

tessell/widgets/virtual_list.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(row_count : Int32, row_height : Int32 | RowHeightProc, viewport_h : Int32, fetch : Proc(Int32, Nil), viewport_w : Int32 = 1) #

[View source]

Instance Method Detail

def acquired_total : Int32 #

recycle stats


[View source]
def bind_visible(&block : Int32, Int32 -> Nil) : Int32 #

Bind only visible rows. Calls fetch(index) for each visible row and yields (index, offset). Tracks recycler acquire/release/reused/created by diffing visible ranges.


[View source]
def created_total : Int32 #

[View source]
def dirty_rects(max_regions : Int32 = 8) : NamedTuple(count: Int32, area: Int64) #

Dirty rects from accumulated scroll since last call. < viewport_h => up to 2 strips (old exposed + new exposed); >= viewport_h => 1 full window. Returns {count, area}. Uses Dirty.merge_into into reusable sink.


[View source]
def each_visible(&block : Int32, Int32 -> Nil) : Int32 #

[View source]
def fetched_count : Int32 #

[View source]
def invalidate_heights : Nil #

[View source]
def invalidate_row(i : Int32) : Nil #

[View source]
def node_offset(i : Int32) : Int32 #

[View source]
def pool_size : Int32 #

[View source]
def prepare_visible : Int32 #

Reconcile recycler accounting for current visible range and fetch visible rows. No block/yield: hot-path friendly (avoids closure/Proc capture in caller). Returns fetched_count. Use visible_first/visible_last + node_offset(i) to iterate work.


[View source]
def recycle_stats : NamedTuple(acquired: Int32, released: Int32, reused: Int32, created: Int32, pool_size: Int32) #

[View source]
def released_total : Int32 #

[View source]
def resize_viewport(width : Int32, height : Int32) : Nil #

视口尺寸变化:更新可见窗口与回收池估算,不重建行数据。


[View source]
def reused_total : Int32 #

[View source]
def row_count : Int32 #

[View source]
def scroll_by(dy : Int32) : Int32 #

[View source]
def scroll_to(y : Int32) : Int32 #

[View source]
def scroll_y : Int32 #

[View source]
def total_height : Int32 #

[View source]
def viewport_h : Int32 #

[View source]
def viewport_w : Int32 #

[View source]
def visible_first : Int32 #

[View source]
def visible_last : Int32 #

[View source]
def visible_range : NamedTuple(first: Int32, last: Int32) #

[View source]