zoomTo

suspend fun zoomTo(zoom: TimelineZoom, focusViewportPx: Float)(source)

Moves to zoom, holding the timeline time under focusViewportPx still.

The time under the focal point is read at the current scale before the ladder moves, and the strip is then scrolled so that same time sits under focusViewportPx again at the new one. Without this a step doubles or halves the content width and slides whatever the caller was looking at off screen.

A state that was fitting its viewport stops when this moves zoom, so a later viewport change leaves zoom where this put it. A move to the zoom already set keeps the fit, such as zoomOut at the bottom of the ladder. The zoomIn and zoomOut neighbours go through this too.

Parameters

zoom

The step to move to.

focusViewportPx

The viewport x to hold still, such as a pinch's focal point.