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

Animation of movement of coloured circles is stuttering on desktop #19

Closed
ChrisAJS opened this issue Feb 13, 2022 · 5 comments · Fixed by #29
Closed

Animation of movement of coloured circles is stuttering on desktop #19

ChrisAJS opened this issue Feb 13, 2022 · 5 comments · Fixed by #29
Labels
bug Something isn't working

Comments

@ChrisAJS
Copy link

Some details:
OS: Linux
Version: 0.4.2
Kotlin: 1.5.31
Jetpack Compose Desktop: 1.0.0

The issue is that the location of the coloured circles will only update sporadically (always updating to the correct position on release of the mouse button).

Interestingly, the colour contained within the circles continues to update as you move the cursor around the colour circle.

My usage is as follows:

HarmonyColorPicker(
harmonyMode = harmonyMode.value,
modifier = Modifier.size(400.dp),
onColorChanged = { hsvColor ->
   currentColor = hsvColor.toColor()
   extraColours.clear()
   extraColors.addAll(hsvColor.getColors(colorHarmonyMode = harmonyMode.value))
})

The library is incredible! Happy to test further or provide a video demo.

@ffgiraldez
Copy link
Collaborator

Yeah, a video should be great. I guess something related to how desktop manage clicks compared to mobile

@riggaroo
Copy link
Collaborator

A video would definitely help! I'm not seeing it on my mac with the sample app. Have you tried checking out this sample code base and running ./gradlew desktop:run ?

Screen.Recording.2022-02-14.at.12.08.06.mov

@riggaroo riggaroo added the bug Something isn't working label Feb 14, 2022
@ChrisAJS
Copy link
Author

Hello! Long time no speak (terribly sorry!)

Please find attached a video demonstrating the issue:

colour-picker.mp4

This was using the current source code as it stands in main.

As you can see, minor movements does result in animation of sorts (not as smooth as the video from Mac OS), but quick movements see the colour indicators lock in place, as the colour inside them miraculously and fluidly animates.

@riggaroo
Copy link
Collaborator

@ChrisAJS Can you try this branch and let me know if it fixes the issue for you? https://github.com/godaddy/compose-color-picker/tree/bugfix/stuttering-linux

@ChrisAJS
Copy link
Author

The branch seems to do the job perfectly!

This is what the experience looks like now:

fixed.mp4

riggaroo added a commit that referenced this issue Sep 26, 2022
* Fix dragging lag on Linux #19
riggaroo added a commit that referenced this issue Sep 26, 2022
* Attempting to fix dragging lag on Linux #19

* Use rememberUpdatedState for lambdas that are captured to ensure it uses the latest value when calling it.

* Fix issue with resizing of color wheel

* Fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants