-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Labels
Description
Describe the bug
When using DragControls the hoveroff event doesn't fire when the pointer moves from one draggable object to another without first moving off the original object. This doesn't impact the drag functionality but leaves objects without having hoveroff event code executed.
To Reproduce
- With DragControls enabled hover directly from one draggable object to another.
- See the live example below.
Code
The fix that works for me is to insert this code at line 107 of DragControls.js but I'm not experienced with javascript or three.js so I happily defer to the experts. I've prepared a branch with this fix as per the contribution instructions, please let me know if I should submit the pull request.
if ( _hovered !== object && _hovered !== null) {
scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
_domElement.style.cursor = 'auto';
_hovered = null;
}Live example
- Go to https://did.makerchain.ca/dragcontrols.issue
- Click to add a few dividers and move the pointer over the divider intersections
- Notice that dividers get left coloured red.
- Go to https://did.makerchain.ca/dragcontrols.issue.fixed to see it working with my suggested DragControls.js change
Expected behavior
Objects should always have the hoveroff event fire.
Platform:
- Device: Desktop
- OS: MacOS
- Browser: Chrome, Firefox
- Three.js version: r126
Mugen87 and mrdoob