public interface TextInclusionStrategy
The text inclusion strategy used by Paragraph.getRangeForRect, it specifies when a range of text is inside the given rect based on the geometric relation between the text range's bounding box and the given rect.
Functions
isIncluded
public fun isIncluded(textBounds: Rect, rect: Rect): Boolean
Returns true if this TextInclusionStrategy considers the text range's textBounds to be inside the given rect.
Parameters
| textBounds | the bounding box of a range of the text. |
| rect | a rectangle area. |
Members
Companion
public companion object
Properties
AnyOverlap
public val AnyOverlap: TextInclusionStrategy = TextInclusionStrategy { textBounds, rect ->
textBounds.overlaps(rect)
}
The TextInclusionStrategy that includes the text range whose bounds has any overlap with the given rect.
ContainsAll
public val ContainsAll: TextInclusionStrategy = TextInclusionStrategy { textBounds, rect ->
!rect.isEmpty &&
textBounds.left >= rect.left &&
textBounds.right <= rect.right &&
textBounds.top >= rect.top &&
textBounds.bottom <= rect.bottom
}
The TextInclusionStrategy that includes the text range whose bounds is completely contained by the given rect.
ContainsCenter
public val ContainsCenter: TextInclusionStrategy =
TextInclusionStrategy { textBounds, rect ->
rect.contains(textBounds.center)
}
The TextInclusionStrategy that includes the text range whose bounds' center is contained by the given rect.