Back to API Reference
Class

UniTextDocumentView

sealed
Inherits:UIBehaviour
Implements:IInitializePotentialDragHandlerIBeginDragHandlerIDragHandlerIEndDragHandlerIScrollHandler

Scrolls a document text. This RectTransform is the viewport: the text below it is stretched to fill it, and what scrolls is the text's own DocumentTop — a block and an offset into it, so nothing under the viewport moves when the estimated heights above it are corrected. Drag, wheel, inertia and elastic ends behave as uGUI's Scroll Rect does; uGUI scrollbars attach as usual, and a RectMask2D on the viewport clips, as in any scroll view.

Nested Types

public UniText Text{ get; set }
public Scrollbar VerticalScrollbar{ get; set }
public Scrollbar HorizontalScrollbar{ get; set }
public StartEdge StartAt{ get; set }
public double Position{ get; set }

Document Y at the viewport's top edge; setting it teleports there, clamped to the document, and stops any movement.

public void ScrollToStart()

Shows the document's start.

public void ScrollToEnd()

Shows the document's end.

public void StopMovement()

Ends inertia; an overshoot still springs back.

protected override void OnEnable()
protected override void OnDisable()
protected override void OnRectTransformDimensionsChange()
public void OnInitializePotentialDrag()
public void OnBeginDrag()
public void OnDrag()

The content follows the pointer by its movement since the last event, and the velocity a drag leaves behind is measured from that movement, so a block measured meanwhile — which moves the document's numbers, not the content — jolts neither.

public void OnEndDrag()
public void OnScroll()