File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -491,9 +491,15 @@ export function useHeTree<T extends Record<string, any>>(
491491 return
492492 }
493493 // listen dragend. dragend only trigger in dragstart node
494- const isOutside = ! placeholder // placeholder is removed if dragleave the tree
494+ let isOutside = ! placeholder // placeholder may be removed if dragleave the tree
495+ if ( ! isOutside ) {
496+ // get isOutside by coordinates
497+ const rootEl = rootRef . current as HTMLElement
498+ let rect = rootEl . getBoundingClientRect ( )
499+ isOutside = ! ( e . pageX >= rect . left && e . pageX <= rect . right && e . pageY >= rect . top && e . pageY <= rect . bottom )
500+ }
495501 const customized = props . onDragEnd ?.( e , draggingStat ! , isOutside ) === false
496- if ( ! customized && ! isOutside ) {
502+ if ( ! customized && placeholder ) {
497503 let targetIndexInSiblings = placeholder . index
498504 if ( placeholder . parentStat === draggingStat . parentStat && draggingStat . index < targetIndexInSiblings ) {
499505 targetIndexInSiblings --
You can’t perform that action at this time.
0 commit comments