Browse Source

web: fix mouse event for safari mobile (#1288)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1292/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
1638f0f08b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/events/SyntheticMouseEvent.kt

8
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/events/SyntheticMouseEvent.kt

@ -23,8 +23,12 @@ open class SyntheticMouseEvent internal constructor(
val clientY: Int = nativeEvent.clientY val clientY: Int = nativeEvent.clientY
val ctrlKey: Boolean = nativeEvent.ctrlKey val ctrlKey: Boolean = nativeEvent.ctrlKey
val metaKey: Boolean = nativeEvent.metaKey val metaKey: Boolean = nativeEvent.metaKey
val movementX: Int = nativeEvent.asDynamic().movementX as Int
val movementY: Int = nativeEvent.asDynamic().movementY as Int // https://github.com/JetBrains/compose-jb/issues/1053
// movementX and movementY are undefined in SafariMobile MouseEvent
val movementX: Int = (nativeEvent.asDynamic().movementX as? Int) ?: 0
val movementY: Int = (nativeEvent.asDynamic().movementY as? Int) ?: 0
val offsetX: Double = nativeEvent.offsetX val offsetX: Double = nativeEvent.offsetX
val offsetY: Double = nativeEvent.offsetY val offsetY: Double = nativeEvent.offsetY
val pageX: Double = nativeEvent.pageX val pageX: Double = nativeEvent.pageX

Loading…
Cancel
Save