Merge pull request #4712 from MaximilianKrambach/fix4711
fix sorting tree condition #4711
This commit is contained in:
commit
6b25e62cec
@ -743,28 +743,30 @@ export class SortingTreeComponent<T extends Identifiable & Displayable> implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the neighbor below has a level equals to two or more higher than the moved node.
|
// Check if the neighbor below has a level equals to two or more higher than the moved node.
|
||||||
if (
|
if (nextNeighborBelow) {
|
||||||
(nextNeighborBelow && nextNeighborBelow.level >= nextLevel + 2) ||
|
if (
|
||||||
(nextNeighborBelow.level === nextLevel + 1 && nextNeighborBelow.filtered)
|
nextNeighborBelow.level >= nextLevel + 2 ||
|
||||||
) {
|
(nextNeighborBelow.level === nextLevel + 1 && nextNeighborBelow.filtered)
|
||||||
let found = false;
|
) {
|
||||||
for (let i = nextIndex + 1; i < this.osTreeData.length; ++i) {
|
let found = false;
|
||||||
if (this.osTreeData[i].level <= nextLevel && node !== this.osTreeData[i]) {
|
for (let i = nextIndex + 1; i < this.osTreeData.length; ++i) {
|
||||||
found = true;
|
if (this.osTreeData[i].level <= nextLevel && node !== this.osTreeData[i]) {
|
||||||
nextIndex = verticalMove === Direction.UPWARDS ? i : i - 1;
|
found = true;
|
||||||
break;
|
nextIndex = verticalMove === Direction.UPWARDS ? i : i - 1;
|
||||||
} else if (node === this.osTreeData[i] && this.osTreeData[i + 1].level <= nextLevel + 1) {
|
break;
|
||||||
// Remain at the same position and change only the level if changed.
|
} else if (node === this.osTreeData[i] && this.osTreeData[i + 1].level <= nextLevel + 1) {
|
||||||
nextIndex = previousIndex;
|
// Remain at the same position and change only the level if changed.
|
||||||
found = true;
|
nextIndex = previousIndex;
|
||||||
break;
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
nextIndex = this.osTreeData.length - 1;
|
||||||
|
}
|
||||||
|
if (verticalMove === Direction.NOWAY || previousIndex < nextIndex) {
|
||||||
|
verticalMove = Direction.DOWNWARDS;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
nextIndex = this.osTreeData.length - 1;
|
|
||||||
}
|
|
||||||
if (verticalMove === Direction.NOWAY || previousIndex < nextIndex) {
|
|
||||||
verticalMove = Direction.DOWNWARDS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user