Docsv3.31.0
Back to API Reference
Class

UniTextDocumentView

sealed
Inherits:UIBehaviour
Implements:IInitializePotentialDragHandlerIBeginDragHandlerIDragHandlerIEndDragHandlerIScrollHandler

Provides a viewport, drag and wheel scrolling, inertia, elastic edges and optional scrollbars for Canvas text of any length; drives the text RectTransform to fill this view.

Nested Types

public UniText Text{ get; set }
public Scrollbar VerticalScrollbar{ get; set }
public Scrollbar HorizontalScrollbar{ get; set }
public UniTextDocumentView.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(PointerEventData eventData)
public void OnBeginDrag(PointerEventData eventData)
public void OnDrag(PointerEventData eventData)

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(PointerEventData eventData)
public void OnScroll(PointerEventData data)