-
Notifications
You must be signed in to change notification settings - Fork 483
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
fix: hide indicator outside the droppable area (#477) #478
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/tree/4svGaubrM3WKbzJ1BzCETaC3WEYN |
Codecov Report
@@ Coverage Diff @@
## master #478 +/- ##
=======================================
Coverage 99.74% 99.75%
=======================================
Files 11 11
Lines 1194 1203 +9
Branches 354 349 -5
=======================================
+ Hits 1191 1200 +9
Misses 3 3
Continue to review full report at Codecov.
|
src/Tree.tsx
Outdated
@@ -22,7 +22,7 @@ import { | |||
calcDropPosition, | |||
arrAdd, | |||
arrDel, | |||
posToArr, | |||
posToArr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
posToArr | |
posToArr, |
src/Tree.tsx
Outdated
@@ -278,6 +278,8 @@ class Tree extends React.Component<TreeProps, TreeState> { | |||
|
|||
dragNode: NodeInstance; | |||
|
|||
dragEnterDroppableNodeKey = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentMouseOverDroppableNodeKey
@07akioni find a new problem with this solution, drag enter/leave event fired when hovering children element. Refer to https://stackoverflow.com/questions/7110353/html5-dragleave-fired-when-hovering-a-child-element, I add a dragenter counter to check whether the mouse leave the draggable element. |
Why not checking currentTarget? |
Checking event.currentTarget === event.target? As the cursor switches between the internal blank area and the child element, event.target will return the draggable element node multiple times(Codepen Demo). Thus, It cannot used to check the cursor has left. |
Nice demo. How about
|
awesome! It's a better solution. |
Resolves ant-design/ant-design#31555, resolves #477