Skip to content

Interface: ViewportState

@roomful/core


@roomful/core / ViewportState

Defined in: packages/core/src/types.ts:1067

Describes a peer’s viewport — scroll position, zoom, and dimensions of the tracked container — shared so peers can follow one another.

Scroll coordinates are normalized to the 01 range (a fraction of the scrollable area) so they stay consistent across different screen sizes.

focusedElement: string | null

Defined in: packages/core/src/types.ts:1107

Identifies the peer’s focused element as a CSS selector, or null when none is reported.


peerId: string

Defined in: packages/core/src/types.ts:1071

Identifies the peer that owns this viewport state.


scrollX: number

Defined in: packages/core/src/types.ts:1078

Reports the horizontal scroll position as a fraction of the scrollable width, from 0 (fully left) to 1 (fully right). 0 when the tracked element cannot scroll horizontally.


scrollY: number

Defined in: packages/core/src/types.ts:1085

Reports the vertical scroll position as a fraction of the scrollable height, from 0 (fully top) to 1 (fully bottom). 0 when the tracked element cannot scroll vertically.


viewportHeight: number

Defined in: packages/core/src/types.ts:1101

Reports the tracked element’s viewport height in CSS pixels.


viewportWidth: number

Defined in: packages/core/src/types.ts:1096

Reports the tracked element’s viewport width in CSS pixels.


zoom: number

Defined in: packages/core/src/types.ts:1091

Reports the peer’s zoom level, where 1 represents 100%. Zoom is carried for the consuming app to apply, since how zoom is applied is app-specific.