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

Slider. Proper mouse handling #325

Closed
igordmn opened this issue Jan 28, 2021 · 1 comment
Closed

Slider. Proper mouse handling #325

igordmn opened this issue Jan 28, 2021 · 1 comment
Assignees
Labels
bug Something isn't working desktop input Touch, mouse, keyboard input related

Comments

@igordmn
Copy link
Collaborator

igordmn commented Jan 28, 2021

import androidx.compose.desktop.Window
import androidx.compose.material.Slider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue

fun main() = Window {
    var value by remember { mutableStateOf(5f) }
    Slider(
        value = value,
        valueRange = 0f..10f,
        onValueChange = { value = it }
    )
}

When we drag the slider with mouse, dragging don't start immedeately:
https://user-images.githubusercontent.com/5963351/106154944-327ae880-6191-11eb-9bc6-b3581d0e04c8.mp4

We should introduce proper mouse handling to Slider component. Because non-immediate start of dragging should only happened with touch gestures.

See also #320 (comment)

@igordmn igordmn added the input Touch, mouse, keyboard input related label Jan 28, 2021
@igordmn igordmn self-assigned this Jan 28, 2021
@akurasov akurasov added bug Something isn't working desktop labels Jul 16, 2021
@igordmn
Copy link
Collaborator Author

igordmn commented Nov 2, 2021

Should be fixed in 1.0.0-beta5

@igordmn igordmn closed this as completed Nov 2, 2021
MatkovIvan pushed a commit to MatkovIvan/compose-multiplatform that referenced this issue May 10, 2023
If there are animations on the screen, after some time we will encounter performance degradation, and an increased memory consumption.

This fix is similar to the other fix in the past (https://android-review.googlesource.com/c/platform/frameworks/support/+/1398690). We have to remember the lambda instead of creating it each time.

Fixes JetBrains#2455
Fixes JetBrains#1969

The tests are not very deterministic, but it seems better to have them than not to have. The second test fails before the fix, and passes after the fix.
We will see if they will be stable on our CI or not. If they will be flaky, we will tune them, or remove them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desktop input Touch, mouse, keyboard input related
Projects
None yet
Development

No branches or pull requests

2 participants