Interface: ViewportState
@roomful/core / ViewportState
Interface: ViewportState
Section titled “Interface: 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 0–1 range (a fraction of the
scrollable area) so they stay consistent across different screen sizes.
Properties
Section titled “Properties”focusedElement
Section titled “focusedElement”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
Section titled “peerId”peerId:
string
Defined in: packages/core/src/types.ts:1071
Identifies the peer that owns this viewport state.
scrollX
Section titled “scrollX”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
Section titled “scrollY”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
Section titled “viewportHeight”viewportHeight:
number
Defined in: packages/core/src/types.ts:1101
Reports the tracked element’s viewport height in CSS pixels.
viewportWidth
Section titled “viewportWidth”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.