loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / COLLECTIONS AND INTERACTION

ScrollView

A clipped view of a caller-owned cell buffer, with independent horizontal and vertical offsets.

The content buffer can be cached between draws. This widget copies only visible cells; it does not allocate a second content-sized buffer. Wide glyphs cut by either edge are omitted.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Members on this page

Feature guides and release status

ScrollView

Structure
struct ScrollView

Conforms to: Widget.

A clipped view of a caller-owned cell buffer, with independent horizontal and vertical offsets.

The content buffer can be cached between draws. This widget copies only visible cells; it does not allocate a second content-sized buffer. Wide glyphs cut by either edge are omitted.

Source · ScrollView.swift:5

content

Instance Property
var content: Buffer

A public field of this type. Its value type and mutability are shown in the declaration.

Source · ScrollView.swift:6

horizontalOffset

Instance Property
var horizontalOffset: Int

A public field of this type. Its value type and mutability are shown in the declaration.

Source · ScrollView.swift:7

verticalOffset

Instance Property
var verticalOffset: Int

A public field of this type. Its value type and mutability are shown in the declaration.

Source · ScrollView.swift:8

init(_:horizontalOffset:verticalOffset:)

Initializer
init(_ content: Buffer, horizontalOffset: Int = 0, verticalOffset: Int = 0)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (3)
content
Argument type and any default are shown in the declaration; see the behavior notes above.
horizontalOffset
Argument type and any default are shown in the declaration; see the behavior notes above.
verticalOffset
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · ScrollView.swift:10

render(in:buffer:)

Instance Method
func render(in area: Rect, buffer: inout Buffer)

Paints this widget into the assigned terminal-cell rectangle. Application code owns state, input routing, and terminal lifetime.

Parameters (2)
in
Argument type and any default are shown in the declaration; see the behavior notes above.
buffer
Mutable destination cell grid.
Source · ScrollView.swift:16

contentPoint(at:in:)

Instance Method
func contentPoint(at point: Point, in area: Rect) -> Point?

Translates a viewport hit to content coordinates, excluding blank padding.

Parameters (2)
at
Argument type and any default are shown in the declaration; see the behavior notes above.
in
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns Point?.

Source · ScrollView.swift:36