mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
fix: improve drag behaviour when using handle (#2407)
Fixes a small bug that caused the item to be draggable when clicking outside of the handle, when using a handle. Basically resets the draggable state when (re)entering the container.
This commit is contained in:
parent
29da625195
commit
bd686eb246
@ -74,6 +74,9 @@ const addEventListeners = (
|
||||
|
||||
handleEl.addEventListener('mouseenter', onMouseEnter);
|
||||
handleEl.addEventListener('mouseleave', onMouseLeave);
|
||||
if (handle) {
|
||||
el.addEventListener('mouseenter', onMouseLeave);
|
||||
}
|
||||
el.addEventListener('dragstart', onDragStart);
|
||||
el.addEventListener('dragenter', onDragEnter);
|
||||
el.addEventListener('dragover', onDragOver);
|
||||
@ -82,6 +85,9 @@ const addEventListeners = (
|
||||
return () => {
|
||||
handleEl.removeEventListener('mouseenter', onMouseEnter);
|
||||
handleEl.removeEventListener('mouseleave', onMouseLeave);
|
||||
if (handle) {
|
||||
el.removeEventListener('mouseenter', onMouseLeave);
|
||||
}
|
||||
el.removeEventListener('dragstart', onDragStart);
|
||||
el.removeEventListener('dragenter', onDragEnter);
|
||||
el.removeEventListener('dragover', onDragOver);
|
||||
|
Loading…
Reference in New Issue
Block a user