SelectText

Entityceramic.SelectText (Class)

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

selectionBackgrounds: Array<Quad>

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

emitSelection(selectionStart: Int, selectionEnd: Int, inverted: Bool): Void

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)

emitContainerChange(current: Visual, previous: Visual): Void

Event when container field changes.

Name Type
current Visual
previous Visual

emitAllowSelectingFromPointerChange(current: Bool, previous: Bool): Void

Event when allowSelectingFromPointer field changes.

Name Type
current Bool
previous Bool

emitShowCursorChange(current: Bool, previous: Bool): Void

Event when showCursor field changes.

Name Type
current Bool
previous Bool

emitSelectionStartChange(current: Int, previous: Int): Void

Event when selectionStart field changes.

Name Type
current Int
previous Int

emitSelectionEndChange(current: Int, previous: Int): Void

Event when selectionEnd field changes.

Name Type
current Int
previous Int

emitInvertedSelectionChange(current: Bool, previous: Bool): Void

Event when invertedSelection field changes.

Name Type
current Bool
previous Bool

emitPointerIsDownChange(current: Bool, previous: Bool): Void

Event when pointerIsDown field changes.

Name Type
current Bool
previous Bool

bindAsComponent(): Void

updateFromSelection(): Void

updateSelectionGraphics(): Void

doUpdateSelectionGraphics(): Void

clearSelectionGraphics(): Void

handleShowCursorChange(_: Bool, _: Bool): Void
Name Type
_ Bool
_ Bool

updateCursorVisibility(delta: Float): Void
Name Type
delta Float

resetCursorVisibility(): Void

updatePointerEventBindings(): Void

indexFromScreenPosition(x: Float, y: Float): Int
Name Type
x Float
y Float
Returns
Int

handlePointerDown(info: TouchInfo): Void
Name Type
info TouchInfo

handlePointerMove(info: TouchInfo): Void
Name Type
info TouchInfo

handlePointerUp(info: TouchInfo): Void
Name Type
info TouchInfo

updateSelectionFromMovingPointer(x: Float, y: Float): Void
Name Type
x Float
y Float

isSelectionBoundChararacter(c: String): Bool
Name Type
c String
Returns
Bool

handleDoubleClick(): Void

bindKeyBindings(): Void

setEntity(entity: Entity): 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()