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.

Source set: Common
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

Source set: Common
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

Source set: Common
public companion object

Properties

AnyOverlap

Source set: Common
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

Source set: Common
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

Source set: Common
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.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: