Skip to content
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

Fix gesture completion #685

Merged
merged 4 commits into from
Jul 18, 2023
Merged

Fix gesture completion #685

merged 4 commits into from
Jul 18, 2023

Conversation

MatkovIvan
Copy link
Member

Proposed Changes

  • Send Release only to pressOwner
  • Send Release even if it's under focused to finish gestures for pressOwner
  • Update hovered state (send Exit) if owner appears under focused

Testing

Test: run PopupTest or demo app

Issues Fixed

Fixes:

Copy link

@m-sasha m-sasha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another use-case that is broken, but I think it was already broken:

  • Right mouse down: opens context menu
  • Move mouse into a menu item in the context menu
  • Release mouse button to select menu item

@igordmn
Copy link
Collaborator

igordmn commented Jul 18, 2023

There's another use-case that is broken, but I think it was already broken:

Reproducible also for Box'es:

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.onPointerEvent
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.singleWindowApplication

@OptIn(ExperimentalComposeUiApi::class)
fun main() = singleWindowApplication {
    var visible by remember { mutableStateOf(false) }
    Box(Modifier.size(100.dp).background(Color.Red).onPointerEvent(PointerEventType.Press) {
        visible = true
        println("Press")
    })

    if (visible) {
        Box(Modifier.size(60.dp).background(Color.Blue).onPointerEvent(PointerEventType.Release) {
            visible = false
            println("Release")
        })
    }
}

@igordmn
Copy link
Collaborator

igordmn commented Jul 18, 2023

Created: JetBrains/compose-multiplatform#3365

@MatkovIvan
Copy link
Member Author

Reproducible also for Box'es

It's inside single owner, so it's not about scene implementation

@MatkovIvan MatkovIvan merged commit 2ffe61b into jb-main Jul 18, 2023
2 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/fix-owner-input-v2 branch July 18, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants