scoop:scoop.ui:0.1.0
src/scroll/intent.scoop
Selected production source · src/scroll/intent.scoop
1
package scoop.ui3
/** Sources of explicit position requests; layout corrections are not requests. */4
public enum ScrollOrigin {5
User, Programmatic6
}8
public enum ScrollIntent {9
User(val revision: ULong),10
Programmatic(val revision: ULong),11
LayoutCorrection(val revision: ULong)13
public val requestRevision: ULong get() =14
when (this) {15
case User(val value) -> value16
case Programmatic(val value) -> value17
case LayoutCorrection(val value) -> value18
}19
}21
internal class ScrollIntentSubscription(22
private val owner: ScrollState,23
val handler: (ScrollIntent) -> Unit24
): Closeable {25
var closed = false26
public override fun close() {27
owner.checkMutation()28
if (closed)29
return30
closed = true31
owner.removeSubscription(this)32
}33
}