Several usability improvements, especially for dragging mouse along colors#42
Open
soulmerge wants to merge 5 commits intoDavidDurman:masterfrom
Open
Several usability improvements, especially for dragging mouse along colors#42soulmerge wants to merge 5 commits intoDavidDurman:masterfrom
soulmerge wants to merge 5 commits intoDavidDurman:masterfrom
Conversation
No functional changes, just removed all whitespace at the end of each line.
The function was previously registering all events and selectively performing operations based on a stored state. Changed the behaviour to register and unregister relevant event listeners on specific occasions. This not only removes explicit state, but also grants more flexibility, which will be required for future changes.
Could not pinpoint why, but sometimes a native drag event triggers while sliding the mouse along the palette and suddenly the whole palette is being dragged with the mouse. This commit tries to negate this effect by adding a listener, that attempts to prevent the `dragstart` event.
It feels more robust if the dragging continues even if the mouse leaves the area that contains the drag listener. This makes it easier to pick colors near the edges (particularly near *two* edges, i.e. in the corners) For this to work, another listener had to be altered: the `mouseup` listener is now registered on document.body, instead of the drag area. It is also unregistered once the dragging is complete.
It is now possible to continue dragging along an edge, even if the mouse pointer is outside of the target area. This means that dragging along an edge or into a corner is now absolutely precise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found several small issues while working with the pickers: The color picking process was stopping as soon the mouse pointer left the picker area, which made it very hard to choose colors on edges or corners.
I tried to provide several independent commits, each one just adding a small feature. I also aimed to retain compatibility with ancient IE versions without changing the API behavior.