Package limn.graphics
Record Class ShapedText.Position
java.lang.Object
java.lang.Record
limn.graphics.ShapedText.Position
- Record Components:
charIndex- char index into the line's text, in logical orderaffinity- which side of it the caret is on
- Enclosing class:
ShapedText
public static record ShapedText.Position(int charIndex, ShapedText.Affinity affinity)
extends Record
A caret position: where text is inserted, plus which side of that index the caret is on.
The index alone is the insertion point, and is what the edit model, the clipboard and the
IME need. The pair is what the line needs: on a direction boundary one index is two
points, so ShapedText.hitTest(float) hands back a pair and ShapedText.caretLeft(limn.graphics.ShapedText.Position) moves
between pairs. Off a boundary the side changes nothing.
-
Constructor Summary
ConstructorsConstructorDescriptionPosition(int charIndex, ShapedText.Affinity affinity) Creates an instance of aPositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaffinity()Returns the value of theaffinityrecord component.intReturns the value of thecharIndexrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
charIndex
public int charIndex()Returns the value of thecharIndexrecord component.- Returns:
- the value of the
charIndexrecord component
-
affinity
Returns the value of theaffinityrecord component.- Returns:
- the value of the
affinityrecord component
-