Skip to content

fix: maps mouse events to document for improved UX #93

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mariojankovic
Copy link

@mariojankovic mariojankovic commented Jul 24, 2024

Problem

The mousemove and mouseup events were previously bound directly to the board element div. This caused difficulties for users trying to select colors at the extreme edges of the color picker, such as full black or full white. Users had to position their mouse precisely at the edges, which was often impossible, resulting in inaccurate color selection (e.g., a greyish color instead of full black or white).

Solution

The mousemove and mouseup events have been remapped to the document object. This change ensures that the color selection can be accurately tracked even when the mouse moves outside the boundaries of the color picker element. Users can now easily select colors at the extreme edges without needing to precisely position their mouse.

Video

✅ Improved UX (note how my cursor is leaving the board element while holding the left mouse button and still picking the proper color):

CleanShot.2024-07-24.at.16.44.31.mp4

❌ Previous state:

CleanShot.2024-07-24.at.16.44.02.mp4

@mariojankovic
Copy link
Author

I published the package with the above changes until this goes out to main: https://www.npmjs.com/package/@mariojankovic/vue3-colorpicker

@gigabites19
Copy link

@aesoper101 can we get this merged?

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