mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04:00
after moving, e.g. the minicard, round the index to the next integer
- before: at index -1 and -9 the new index was -5 - now : at index -1 (or -1.1) and -9 the new index is -2
This commit is contained in:
parent
c10f7b6134
commit
7e8073d621
1 changed files with 19 additions and 2 deletions
|
@ -343,8 +343,25 @@ Utils = {
|
|||
else {
|
||||
const prevSortIndex = prevData.sort;
|
||||
const nextSortIndex = nextData.sort;
|
||||
increment = (nextSortIndex - prevSortIndex) / (nItems + 1);
|
||||
base = prevSortIndex + increment;
|
||||
if (nItems == 1 ) {
|
||||
if (prevSortIndex < 0 ) {
|
||||
const ceil = Math.ceil(nextSortIndex - 1);
|
||||
if (ceil < nextSortIndex && ceil > prevSortIndex) {
|
||||
increment = ceil - prevSortIndex;
|
||||
}
|
||||
} else {
|
||||
const floor = Math.floor(nextSortIndex - 1);
|
||||
if (floor < nextSortIndex && floor > prevSortIndex) {
|
||||
increment = floor - prevSortIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!increment) {
|
||||
increment = (nextSortIndex - prevSortIndex) / (nItems + 1);
|
||||
}
|
||||
if (!base) {
|
||||
base = prevSortIndex + increment;
|
||||
}
|
||||
}
|
||||
// XXX Return a generator that yield values instead of a base with a
|
||||
// increment number.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue