Struct ScrollTextBuffer.ScrollTextLine
Represents a single line of text with a cached pixel height for efficient scroll calculation.
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
public readonly struct ScrollTextBuffer.ScrollTextLine
Remarks
The struct is immutable. To update the cached height, use WithHeightCache(float, float) which returns a new instance with the updated values while preserving the original text content.
Constructors
ScrollTextLine(string)
Creates a new scroll text line.
Declaration
public ScrollTextLine(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text content. |
ScrollTextLine(string, float, float)
Creates a new scroll text line with cached height information.
Declaration
public ScrollTextLine(string text, float height, float displayWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text content. |
| float | height | The cached pixel height. |
| float | displayWidth | The display width used for calculation. |
Fields
CachedDisplayWidth
The display width that was used when calculating CachedHeight. Used for cache invalidation.
Declaration
public readonly float CachedDisplayWidth
Field Value
| Type | Description |
|---|---|
| float |
CachedHeight
Cached pixel height of this line in pixels, including all wrapped sub-lines. A value of -1 indicates the height has not been calculated yet and must be recomputed before use.
Declaration
public readonly float CachedHeight
Field Value
| Type | Description |
|---|---|
| float |
Text
The text content of this line.
Declaration
public readonly string Text
Field Value
| Type | Description |
|---|---|
| string |
Methods
IsHeightCacheValid(float)
Checks if the height cache is valid for the given display width.
Declaration
public bool IsHeightCacheValid(float displayWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| float | displayWidth | The current display width. |
Returns
| Type | Description |
|---|---|
| bool | True if the cache is valid. |
WithHeightCache(float, float)
Returns a new ScrollTextLine with updated height cache.
Declaration
public ScrollTextBuffer.ScrollTextLine WithHeightCache(float height, float displayWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| float | height | The new height. |
| float | displayWidth | The display width used for calculation. |
Returns
| Type | Description |
|---|---|
| ScrollTextBuffer.ScrollTextLine | A new ScrollTextLine with updated cache. |