StripGrid

class StripGrid(val scale: TimelineScale, val tileWidthPx: Int)(source)

Which source times the strip's tiles sit at, and which of them are on screen.

Tiles are addressed in content pixels, so a tile keeps the source time it shows no matter how far the strip has scrolled. positions feeds rememberFilmstripFrames and visibleRange feeds FilmstripFrames.onVisibleRange .

val grid = remember(scale, tileWidthPx) { StripGrid(scale, tileWidthPx) }
val frames = rememberFilmstripFrames(filmstrip, composition, grid.positions, heightPx)

// Only a strip drawn by hand needs this. FilmstripStrip reports its own window.
LaunchedEffect(grid, frames) {
snapshotFlow { listState.stripScrollPx(grid) }.collect { scrollPx ->
val window = grid.visibleRange(scrollPx, viewportWidthPx)
if (!window.isEmpty()) frames.onVisibleRange(window.first, window.last)
}
}

Constructors

Link copied to clipboard
constructor(scale: TimelineScale, tileWidthPx: Int)

Properties

Link copied to clipboard
val count: Int

How many tiles the strip covers.

Link copied to clipboard

The source time each tile shows.

Link copied to clipboard

The time to pixel mapping the tiles are laid out against.

Link copied to clipboard

How wide one tile is drawn.

Functions

Link copied to clipboard
fun indexAt(time: Duration): Int?

The tile time falls in.

Link copied to clipboard
fun tileWidthPxAt(index: Int): Int

How wide the tile at index is drawn.

Link copied to clipboard
fun visibleRange(scrollPx: Float, viewportWidthPx: Float): IntRange

Which tiles a viewport viewportWidthPx wide shows when scrolled to scrollPx.

Link copied to clipboard

The same grid at scale.

Link copied to clipboard
fun withTileWidth(tileWidthPx: Int): StripGrid

The same grid with tiles tileWidthPx wide.