mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
after moving, e.g. minicards, to the list start / end the index is rounded to the next index
This commit is contained in:
parent
7e8073d621
commit
b869e3efb6
1 changed files with 18 additions and 4 deletions
|
|
@ -331,12 +331,26 @@ Utils = {
|
||||||
increment = 1;
|
increment = 1;
|
||||||
// If we drop the card in the first position
|
// If we drop the card in the first position
|
||||||
} else if (!prevData) {
|
} else if (!prevData) {
|
||||||
base = nextData.sort - 1;
|
const nextSortIndex = nextData.sort;
|
||||||
increment = -1;
|
const ceil = Math.ceil(nextSortIndex - 1);
|
||||||
|
if (ceil < nextSortIndex) {
|
||||||
|
increment = nextSortIndex - ceil;
|
||||||
|
base = nextSortIndex - increment;
|
||||||
|
} else {
|
||||||
|
base = nextData.sort - 1;
|
||||||
|
increment = -1;
|
||||||
|
}
|
||||||
// If we drop the card in the last position
|
// If we drop the card in the last position
|
||||||
} else if (!nextData) {
|
} else if (!nextData) {
|
||||||
base = prevData.sort + 1;
|
const prevSortIndex = prevData.sort;
|
||||||
increment = 1;
|
const floor = Math.floor(prevSortIndex + 1);
|
||||||
|
if (floor > prevSortIndex) {
|
||||||
|
increment = prevSortIndex - floor;
|
||||||
|
base = prevSortIndex - increment;
|
||||||
|
} else {
|
||||||
|
base = prevData.sort + 1;
|
||||||
|
increment = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// In the general case take the average of the previous and next element
|
// In the general case take the average of the previous and next element
|
||||||
// sort indexes.
|
// sort indexes.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue