-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CfW: fix MouseEvent to PointerButton mapping #1274
Conversation
MouseEvent.button should be taken into account only for press and release events
MouseEvent.button should be taken into account only for press and release events
compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/input/pointer/PointerEvent.web.kt
Outdated
Show resolved
Hide resolved
@@ -33,6 +40,7 @@ internal val MouseEvent.composeButton get() = | |||
4 -> PointerButton.Forward | |||
else -> PointerButton(-1) | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's nullable now we can return null in else
section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, there can be more buttons than listed here. Neither -1
nor null
are okay.
I'll return else -> PointerButton(button.toInt())
for now. When I have a mouse with more buttons, I'll check it again.
__
wait a second. the tests fail now. :D let me check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test failed for another reason (fixed). The above comment remains valid from my point of view.
To run the tests:
./gradlew :compose:ui:ui:cleanWasmJsBrowserTest :compose:ui:ui:wasmJsBrowserTest -Pjetbrains.cfw.tests.useChrome=true
It tests the fix for this issue: JetBrains/compose-multiplatform#4134