SelectText
Component that handles text selection and cursor display for Text visuals.
This component provides visual feedback for text selection including selection highlighting and text cursor display. It also handles pointer-based text selection and double-click word selection.
Instance Members
observedDirty: BoolDefault is false, automatically set to true when any of this instance's observable variables has changed.
entity: TextThe Text entity this component is attached to.
selectionColor: ColorColor used for text selection highlighting.
textCursorColor: ColorColor of the text cursor.
textCursorOffsetX: FloatHorizontal offset for the text cursor position.
textCursorOffsetY: FloatVertical offset for the text cursor position.
textCursorHeightFactor: FloatHeight factor for the text cursor (1.0 = full line height).
textCursorWidth: FloatWidth of the text cursor in pixels.
container: VisualOptional container on which pointer events are bound
allowSelectingFromPointer: BoolWhether to allow text selection using pointer/mouse.
showCursor: BoolWhether to show the text cursor.
selectionStart: IntStart position of the current text selection. -1 means no selection.
selectionEnd: IntEnd position of the current text selection. -1 means no selection.
invertedSelection: BoolWhether the selection is inverted (cursor at start instead of end).
pointerIsDown: BoolWhether the pointer is currently pressed down.
initializerName: StringinvalidateContainer(): VoidinvalidateAllowSelectingFromPointer(): VoidinvalidateShowCursor(): VoidinvalidateSelectionStart(): VoidinvalidateSelectionEnd(): VoidinvalidateInvertedSelection(): VoidinvalidatePointerIsDown(): Voidnew(selectionColor: Color, textCursorColor: Color, ?textCursorOffsetX: Float = 0, ?textCursorOffsetY: Float = 0, ?textCursorHeightFactor: Float = 1, ?textCursorWidth: Float = 1): VoidCreate a new SelectText component.
| Name | Type | Default | Description |
|---|---|---|---|
selectionColor |
Color | Color for selection highlighting | |
textCursorColor |
Color | Color of the text cursor | |
textCursorOffsetX |
Float | 0 |
Horizontal offset for cursor position |
textCursorOffsetY |
Float | 0 |
Vertical offset for cursor position |
textCursorHeightFactor |
Float | 1 |
Height factor for cursor (1.0 = full line height) |
textCursorWidth |
Float | 1 |
Width of the cursor in pixels |
Private Members
unobservedContainer: VisualunobservedAllowSelectingFromPointer: BoolunobservedShowCursor: BoolunobservedSelectionStart: IntunobservedSelectionEnd: IntunobservedInvertedSelection: BoolunobservedPointerIsDown: BoolboundContainer: VisualdoubleClick: DoubleClickdidDoubleClick: BoolwillUpdateSelection: BooltextCursor: QuadtextCursorToggleVisibilityTime: FloatemitObservedDirty(instance: SelectText, fromSerializedField: Bool): VoidEvent when any observable value as changed on this instance.
| Name | Type |
|---|---|
instance |
SelectText |
fromSerializedField |
Bool |
Event fired when the text selection changes.
| Name | Type | Description |
|---|---|---|
selectionStart |
Int | Start position of the selection |
selectionEnd |
Int | End position of the selection |
inverted |
Bool | Whether the selection is inverted (cursor at start) |
Event when container field changes.
| Name | Type |
|---|---|
current |
Visual |
previous |
Visual |
Event when allowSelectingFromPointer field changes.
| Name | Type |
|---|---|
current |
Bool |
previous |
Bool |
Event when showCursor field changes.
| Name | Type |
|---|---|
current |
Bool |
previous |
Bool |
Event when selectionStart field changes.
| Name | Type |
|---|---|
current |
Int |
previous |
Int |
Event when selectionEnd field changes.
| Name | Type |
|---|---|
current |
Int |
previous |
Int |
Event when invertedSelection field changes.
| Name | Type |
|---|---|
current |
Bool |
previous |
Bool |
Event when pointerIsDown field changes.
| Name | Type |
|---|---|
current |
Bool |
previous |
Bool |
bindAsComponent(): VoidupdateFromSelection(): VoidupdateSelectionGraphics(): VoiddoUpdateSelectionGraphics(): VoidclearSelectionGraphics(): Void| Name | Type |
|---|---|
_ |
Bool |
_ |
Bool |
| Name | Type |
|---|---|
delta |
Float |
resetCursorVisibility(): VoidupdatePointerEventBindings(): Void| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Returns |
|---|
| Int |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
x |
Float |
y |
Float |
| Name | Type |
|---|---|
c |
String |
| Returns |
|---|
| Bool |
handleDoubleClick(): VoidbindKeyBindings(): Void| Name | Type |
|---|---|
entity |
Entity |
getEntity(): Entity| Returns |
|---|
| Entity |
Metadata
| Name | Parameters |
|---|---|
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
ceramic.macros.ComponentMacro.build() |
:autoBuild |
ceramic.macros.ComponentMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |