8000 Fix Dragging Issue on HsvColorPicker, AlphaSlider, and BrightnessSlider by kitakkun · Pull Request #29 · skydoves/colorpicker-compose · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix Dragging Issue on HsvColorPicker, AlphaSlider, and BrightnessSlider #29

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

Merged

Conversation

kitakkun
Copy link
Contributor
@kitakkun kitakkun commented Jul 4, 2023

🎯 Goal

May be related to the Issue #25.

This PR fixes dragging gesture doesn't work properly on HsvColorPicker, AlphaSlider, and BrightnessSlider when its parent is scrollable.

🛠 Implementation details

replaced pointerInteropFilter with pointerInput.

NOTE: There's code logic duplication in AlphaSlider and BrightnessSlider. So, these files should be refactored in some way...

✍️ Explain examples

This issue only happens when the parent is scrollable. To reproduce this issue, please test this example. (I'm using Column with verticalScroll Modifier, but it can be a LazyColumn.)

@Composable
fun Example() {
    val controller = rememberColorPickerController()
    Column(
        modifier = Modifier.verticalScroll(rememberScrollState())
    ) {
        HsvColorPicker(
            modifier = Modifier
                .aspectRatio(1f)
                .fillMaxWidth(),
            controller = controller
        )
        AlphaSlider(
            modifier = Modifier
                .fillMaxWidth()
                .padding(10.dp)
                .height(35.dp),
            controller = controller
        )

        BrightnessSlider(
            modifier = Modifier
                .fillMaxWidth()
                .padding(10.dp)
                .height(35.dp),
            controller = controller
        )
    }
}

Video

before after

FYI

I came up with replacing pointer-input implementation because of this question on StackOverflow. (https://stackoverflow.com/questions/73676427/android-jetpack-compose-action-up-only-reached-for-tap-but-not-after-action-mov)

I love this library, and I'm using it in my personal project. I'm in trouble with this issue. Could you review my PR? 🙏🏻

Thank you.

@kitakkun kitakkun requested a review from skydoves as a code owner July 4, 2023 08:52
Copy link
Owner
@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Hey @kitakkun, this is a great improvement. Thanks you for your contribution!

@skydoves skydoves merged commit 6642e52 into skydoves:main Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0