public class SemanticsOwner internal constructor(
private val rootNode: LayoutNode,
private val outerSemanticsNode: EmptySemanticsModifier,
private val nodes: IntObjectMap<LayoutNode>,
)
Owns SemanticsNode objects and notifies listeners of changes to the semantics tree
Properties
rootSemanticsNode
public val rootSemanticsNode: SemanticsNode
The root node of the semantics tree. Does not contain any unmerged data. May contain merged data.
unmergedRootSemanticsNode
public val unmergedRootSemanticsNode: SemanticsNode
Root node of the unmerged semantics tree.
Functions
get
public operator fun get(semanticsId: Int): SemanticsNode?
Returns the unmerged SemanticsNode with semanticsId, or null if no attached layout with that id has semantics.
Allocates a SemanticsNode. Use getLayoutInfo with LayoutInfo.semanticsConfiguration when only the layout or its unmerged configuration is needed.
Parameters
| semanticsId | The LayoutInfo.semanticsId of the node. |
getLayoutInfo
public fun getLayoutInfo(semanticsId: Int): LayoutInfo?
Returns the attached LayoutInfo with semanticsId, or null if there is none. Doesn't allocate.
Parameters
| semanticsId | The LayoutInfo.semanticsId of the layout. |
hitTest
public fun hitTest(position: Offset, onHit: (layoutInfo: LayoutInfo) -> Boolean): LayoutInfo?
Performs semantics hit testing at position and calls onHit for each hit layout that has semantics, top-most first, until onHit returns true. Each layout is reported once.
Results include hidden nodes; filter them with SemanticsNode.isHidden or LayoutInfo.semanticsConfiguration as needed. Inline text link test markers (SemanticsProperties.LinkTestMarker) are skipped. Hit testing uses the most recent layout, so measure and lay out pending changes first.
Parameters
| position | Pointer position in root coordinates. |
| onHit | Called with each hit layout. Return true to stop at that layout. |
Return
the layout for which onHit returned true, or null if it never did.