jvmMain.io.nacular.doodle.theme.native.NativePointerPreprocessor.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of desktop-jvm Show documentation
Show all versions of desktop-jvm Show documentation
A pure Kotlin, UI framework for the Web
package io.nacular.doodle.theme.native
import io.nacular.doodle.core.View
import io.nacular.doodle.deviceinput.EventPreprocessor
import io.nacular.doodle.event.PointerEvent
internal typealias NativePointerHandler = (event: PointerEvent) -> Unit
internal class NativePointerPreprocessor: EventPreprocessor {
private val handlers: MutableMap = mutableMapOf()
override fun invoke(pointerEvent: PointerEvent) {
handlers[pointerEvent.target]?.invoke(pointerEvent)
}
fun get(view: View) = handlers[view]
fun set(view: View, handler: NativePointerHandler) {
handlers[view] = handler
}
fun remove(view: View): NativePointerHandler? = handlers.remove(view)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy