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: Bool
Default is false
, automatically set to true
when any of this instance's observable variables has changed.
entity: Text
The Text entity this component is attached to.
selectionColor: Color
Color used for text selection highlighting.
textCursorColor: Color
Color of the text cursor.
textCursorOffsetX: Float
Horizontal offset for the text cursor position.
textCursorOffsetY: Float
Vertical offset for the text cursor position.
textCursorHeightFactor: Float
Height factor for the text cursor (1.0 = full line height).
textCursorWidth: Float
Width of the text cursor in pixels.
container: Visual
Optional container on which pointer events are bound
allowSelectingFromPointer: Bool
Whether to allow text selection using pointer/mouse.
showCursor: Bool
Whether to show the text cursor.
selectionStart: Int
Start position of the current text selection. -1 means no selection.
selectionEnd: Int
End position of the current text selection. -1 means no selection.
invertedSelection: Bool
Whether the selection is inverted (cursor at start instead of end).
pointerIsDown: Bool
Whether the pointer is currently pressed down.
initializerName: String
invalidateContainer(): Void
invalidateAllowSelectingFromPointer(): Void
invalidateShowCursor(): Void
invalidateSelectionStart(): Void
invalidateSelectionEnd(): Void
invalidateInvertedSelection(): Void
invalidatePointerIsDown(): Void
new(selectionColor: Color, textCursorColor: Color, ?textCursorOffsetX: Float = 0, ?textCursorOffsetY: Float = 0, ?textCursorHeightFactor: Float = 1, ?textCursorWidth: Float = 1): Void
Create 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: Visual
unobservedAllowSelectingFromPointer: Bool
unobservedShowCursor: Bool
unobservedSelectionStart: Int
unobservedSelectionEnd: Int
unobservedInvertedSelection: Bool
unobservedPointerIsDown: Bool
boundContainer: Visual
doubleClick: DoubleClick
didDoubleClick: Bool
willUpdateSelection: Bool
textCursor: Quad
textCursorToggleVisibilityTime: Float
emitObservedDirty(instance: SelectText, fromSerializedField: Bool): Void
Event 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(): Void
updateFromSelection(): Void
updateSelectionGraphics(): Void
doUpdateSelectionGraphics(): Void
clearSelectionGraphics(): Void
Name | Type |
---|---|
_ |
Bool |
_ |
Bool |
Name | Type |
---|---|
delta |
Float |
resetCursorVisibility(): Void
updatePointerEventBindings(): 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(): Void
bindKeyBindings(): 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() |