@@ -466,7 +466,6 @@ export default function makeTreeDraggable(treeEl, options = {}) {
466466        } 
467467        // 
468468        store . targetPath  =  options . getPathByBranchEl ( placeholder ) 
469-         store . isDownwardsSameLevelMove  =  isDownwardsSameLevelMove ( ) 
470469        let  pathChanged  =  isPathChanged ( ) 
471470        store . targetPathNotEqualToStartPath  =  pathChanged 
472471        store . pathChangePrevented  =  false 
@@ -496,15 +495,21 @@ export default function makeTreeDraggable(treeEl, options = {}) {
496495      } 
497496      // 
498497      function  isPathChanged ( )  { 
499-         const  { startTree,  targetTree,  startPath,  targetPath,  isDownwardsSameLevelMove}  =  store 
500-         if  ( isDownwardsSameLevelMove )  { 
501-           return  hp . arrayLast ( startPath )  <  hp . arrayLast ( targetPath )  -  1  // if equal, not moved 
502-         } 
503-         return  startTree  !==  targetTree  ||  startPath . toString ( )  !==  targetPath . toString ( ) 
504-       } 
505-       function  isDownwardsSameLevelMove ( )  { 
506498        const  { startTree,  targetTree,  startPath,  targetPath}  =  store 
507-         return  startTree  ===  targetTree  &&  startPath . length  ===  targetPath . length  &&  startPath . slice ( 0 ,  startPath . length  -  1 ) . toString ( )  ===  targetPath . slice ( 0 ,  targetPath . length  -  1 ) . toString ( )  &&  hp . arrayLast ( startPath )  <  hp . arrayLast ( targetPath ) 
499+         if  ( startTree  ===  targetTree  &&  startPath . length  ===  targetPath . length )  { 
500+           if  ( startPath . toString ( )  ===  targetPath . toString ( ) )  { 
501+             return  false 
502+           }  else  { 
503+             // downward same-level move, the end of targetPath is 1 more than real value  
504+             // 同级向下移动时, targetPath的末位比真实值大1 
505+             const  t  =  startPath . slice ( 0 ) 
506+             t [ t . length  -  1 ]  ++ 
507+             if  ( t . toString ( )  ===  targetPath . toString ( ) )  { 
508+               return  false 
509+             } 
510+           } 
511+         } 
512+         return  true 
508513      } 
509514    } , 
510515  } ) 
0 commit comments