File tree Expand file tree Collapse file tree
packages/he-tree-vue/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,11 @@ const cpt = defineComponent({
102102 ondragstart : {
103103 type : Function as PropType < ( event : DragEvent ) => void > ,
104104 } ,
105+ // throttle interval for dragover event
106+ dragOverThrottleInterval : {
107+ type : Number ,
108+ default : 0 ,
109+ } ,
105110 } ,
106111 data ( ) {
107112 return {
@@ -412,6 +417,22 @@ const cpt = defineComponent({
412417 ctx . preventDefault = true ;
413418 }
414419 }
420+ // dragOverThrottleInterval
421+ if ( this . dragOverThrottleInterval > 0 ) {
422+ if ( this . _lastValidDragOver == null ) {
423+ this . _lastValidDragOver = new Date ( ) . getTime ( ) ;
424+ } else {
425+ let nowTime = new Date ( ) . getTime ( ) ;
426+ if (
427+ nowTime - this . _lastValidDragOver >
428+ this . dragOverThrottleInterval
429+ ) {
430+ this . _lastValidDragOver = nowTime ;
431+ } else {
432+ return ;
433+ }
434+ }
435+ }
415436 // return if not moved
416437 const mouse = { x : event . clientX , y : event . clientY } ;
417438 const isMoved2 = isMoved ( mouse , lastMouse ) ;
You can’t perform that action at this time.
0 commit comments