@@ -116,9 +116,6 @@ export default {
116
116
let index = 0
117
117
for ( const { value : el , index : index2 } of hp . iterateAll ( branchEl . parentElement . children ) ) {
118
118
if ( hp . hasClass ( el , 'tree-branch' ) || hp . hasClass ( el , 'tree-placeholder' ) ) {
119
- if ( el === store . dragBranchEl ) {
120
- continue
121
- }
122
119
if ( el === branchEl ) {
123
120
break
124
121
}
@@ -259,34 +256,20 @@ export default {
259
256
} ,
260
257
afterDrop : ( store , t ) => {
261
258
if ( store . pathChanged ) {
262
- const { startTree, targetTree, startPath, targetPath, dragNode} = store
259
+ const { startTree, targetTree, startPath, dragNode} = store
260
+ let { targetPath} = store
263
261
if ( this . cloneWhenDrag !== true ) {
264
262
// remove from start position
265
263
const startParentPath = hp . arrayWithoutEnd ( startPath , 1 )
266
264
const startParent = startTree . getNodeByPath ( startParentPath )
267
265
const startSiblings = startParentPath . length === 0 ? startTree . treeData : startParent . children
268
266
const startIndex = hp . arrayLast ( startPath )
269
267
startSiblings . splice ( startIndex , 1 )
270
- // update targetPath
271
- if ( startTree === targetTree ) {
272
- if ( startPath . length <= targetPath . length ) {
273
- const lenNoEnd = startPath . length - 1
274
- let same = true
275
- for ( let i = 0 ; i < lenNoEnd ; i ++ ) {
276
- const s = startPath [ i ]
277
- const t = targetPath [ i ]
278
- if ( s !== t ) {
279
- same = false
280
- break
281
- }
282
- }
283
- if ( same ) {
284
- const endIndex = startPath . length - 1
285
- if ( startPath [ endIndex ] < targetPath [ endIndex ] ) {
286
- targetPath [ endIndex ] -= 1
287
- }
288
- }
289
- }
268
+ // update targetPath if isDownwardsSameLevelMove
269
+ if ( store . isDownwardsSameLevelMove ) {
270
+ targetPath = targetPath . slice ( 0 )
271
+ const endIndex = startPath . length - 1
272
+ targetPath [ endIndex ] -= 1
290
273
}
291
274
}
292
275
// insert to target position
0 commit comments