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>>(
491
491
return
492
492
}
493
493
// 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
+ }
495
501
const customized = props . onDragEnd ?.( e , draggingStat ! , isOutside ) === false
496
- if ( ! customized && ! isOutside ) {
502
+ if ( ! customized && placeholder ) {
497
503
let targetIndexInSiblings = placeholder . index
498
504
if ( placeholder . parentStat === draggingStat . parentStat && draggingStat . index < targetIndexInSiblings ) {
499
505
targetIndexInSiblings --
You can’t perform that action at this time.
0 commit comments