feat(selector): export connectKeys

This commit is contained in:
lisonge 2024-01-08 10:55:23 +08:00
parent 7d96c5f886
commit 8a8de5d801
2 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class CommonSelector private constructor(
) {
val tracks = selector.tracks
val trackIndex = selector.trackIndex
val connectKeys = selector.connectKeys
fun <T : Any> match(node: T, transform: CommonTransform<T>): T? {
return selector.match(node, transform.transform)

View File

@ -23,6 +23,17 @@ class Selector internal constructor(private val propertyWrapper: PropertyWrapper
if (i < 0) 0 else i
}
val connectKeys by lazy {
var c = propertyWrapper.to
val keys = mutableListOf<String>()
while (c != null) {
c!!.connectSegment.connectExpression
keys.add(c!!.connectSegment.operator.key)
c = c?.to?.to
}
keys.toTypedArray()
}
fun <T> match(
node: T,
transform: Transform<T>,