Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "Remove pointerId from ComposeScene"
  • Loading branch information
igordmn authored Nov 18, 2021
commit 373f88020f9d9ef63a6c0c0ac577eaa4deae88ec
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,12 @@ class WindowInputEventTest {
assertThat(onEnters).isEqualTo(1)
assertThat(onExits).isEqualTo(0)

window.sendMouseEvent(MouseEvent.MOUSE_EXITED, x = 900, y = 500)
awaitIdle()
assertThat(onMoves.size).isEqualTo(2)
assertThat(onEnters).isEqualTo(1)
assertThat(onExits).isEqualTo(1)
// TODO(https://github.com/JetBrains/compose-jb/issues/1176) fix catching exit event
// window.sendMouseEvent(MouseEvent.MOUSE_EXITED, x = 900, y = 500)
// awaitIdle()
// assertThat(onMoves.size).isEqualTo(2)
// assertThat(onEnters).isEqualTo(1)
// assertThat(onExits).isEqualTo(1)

exitApplication()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class ComposeScene internal constructor(
*/
val roots: Set<RootForTest> get() = list

private var pointerId = 0L
private var isMousePressed = false

private val job = Job()
Expand Down Expand Up @@ -390,7 +391,7 @@ class ComposeScene internal constructor(
PointerEventType.Release -> isMousePressed = false
}
val event = pointerInputEvent(
eventType, position, timeMillis, nativeEvent, type, isMousePressed, pointerId = 0
eventType, position, timeMillis, nativeEvent, type, isMousePressed, pointerId
)
when (eventType) {
PointerEventType.Press -> onMousePressed(event)
Expand Down Expand Up @@ -462,6 +463,7 @@ class ComposeScene internal constructor(
val owner = (mousePressOwner ?: hoveredOwner) ?: focusedOwner
owner?.processPointerInput(event)
mousePressOwner = null
pointerId += 1
}

private var pointLocation = Offset.Zero
Expand Down