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

Cursor jumps to the bottom left corner when the color is pure black #867

Open
wfortin opened this issue Sep 2, 2022 · 1 comment
Open

Comments

@wfortin
Copy link

wfortin commented Sep 2, 2022

When the user drags the cursor and hits #000000, the cursor jumps to the bottom left corner. This isn't wrong but makes the experience a little jarring. I would expect the position that the user picks to "stick".

See recording below of the react-color website:
https://user-images.githubusercontent.com/2165256/188221494-26d6352f-946a-44b8-9334-ba52ad835090.mp4

See figma for example (notice that re-opening puts the cursor back to the bottom left, which I think is fine)
https://user-images.githubusercontent.com/2165256/188221563-732b26f4-7a6c-45c8-bbf0-d43bfb70d168.mp4

@ashgrover
Copy link

I ran into this issue as well. This bug is in toState function of color.js. The issue occurs when v part of hsv is 0 then tinycolor library returns 0 for s part as well when color.toHsv() is called, so x-coordinate gets all messed up.

The fix is to not call color.toHsv() when v is 0 and return the incoming hsv values in data arg as it is.

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

No branches or pull requests

2 participants