@@ -337,9 +337,9 @@ export function useHeTree<T extends Record<string, any>>(
337
337
let pl
338
338
if ( ! rtl ) {
339
339
// ltr
340
- pl = Math . ceil ( ( e . pageX - rect . x ) / indent )
340
+ pl = Math . ceil ( ( e . clientX - rect . x ) / indent )
341
341
} else {
342
- pl = Math . ceil ( ( rect . right - e . pageX ) / indent )
342
+ pl = Math . ceil ( ( rect . right - e . clientX ) / indent )
343
343
}
344
344
return hp . between ( pl , 0 , ( closest ?. level || 0 ) + 1 )
345
345
}
@@ -349,7 +349,7 @@ export function useHeTree<T extends Record<string, any>>(
349
349
const topNodeElement = rootEl . querySelector ( `[data-key="${ closest . id } "]` )
350
350
if ( topNodeElement ) {
351
351
const rect = topNodeElement . getBoundingClientRect ( )
352
- atTop = rect . y + rect . height / 2 > e . pageY
352
+ atTop = rect . y + rect . height / 2 > e . clientY
353
353
}
354
354
}
355
355
if ( atTop ) {
@@ -427,7 +427,7 @@ export function useHeTree<T extends Record<string, any>>(
427
427
nodeEls ,
428
428
( nodeEl : HTMLElement ) =>
429
429
nodeEl . getBoundingClientRect ( ) . top -
430
- e . pageY ,
430
+ e . clientY ,
431
431
{ returnNearestIfNoHit : true }
432
432
) ! ;
433
433
let index : number | undefined
@@ -457,12 +457,12 @@ export function useHeTree<T extends Record<string, any>>(
457
457
return false
458
458
}
459
459
460
- const refresh = ( ) => Object . assign ( dragOverInfo , { id : stat . id , x : e . pageX , y : e . pageY , time : Date . now ( ) } )
460
+ const refresh = ( ) => Object . assign ( dragOverInfo , { id : stat . id , x : e . clientX , y : e . clientY , time : Date . now ( ) } )
461
461
if ( dragOverInfo . id !== stat . id ) {
462
462
refresh ( )
463
463
return false
464
464
}
465
- if ( calculateDistance ( e . pageX , e . pageY , dragOverInfo . x , dragOverInfo . y ) > 10 ) {
465
+ if ( calculateDistance ( e . clientX , e . clientY , dragOverInfo . x , dragOverInfo . y ) > 10 ) {
466
466
refresh ( )
467
467
return false
468
468
}
@@ -496,7 +496,7 @@ export function useHeTree<T extends Record<string, any>>(
496
496
// get isOutside by coordinates
497
497
const rootEl = rootRef . current as HTMLElement
498
498
let rect = rootEl . getBoundingClientRect ( )
499
- isOutside = ! ( e . pageX >= rect . left && e . pageX <= rect . right && e . pageY >= rect . top && e . pageY <= rect . bottom )
499
+ isOutside = ! ( e . clientX >= rect . left && e . clientX <= rect . right && e . clientY >= rect . top && e . clientY <= rect . bottom )
500
500
}
501
501
const customized = props . onDragEnd ?.( e , draggingStat ! , isOutside ) === false
502
502
if ( ! customized && placeholder ) {
0 commit comments