mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-30 10:51:13 +02:00
Add index fix again
This was changed on /develop to fix an issue where the incorrect index was being used in a condition to handle literal edge cases of dragging room tiles to start or end of an ordered sublist.
This commit is contained in:
parent
dd0e981d72
commit
1ea6301eca
@ -56,10 +56,13 @@ RoomListActions.tagRoom = function(matrixClient, room, oldTag, newTag, oldIndex,
|
|||||||
newTag === oldTag && oldIndex < newIndex
|
newTag === oldTag && oldIndex < newIndex
|
||||||
) ? 1 : 0;
|
) ? 1 : 0;
|
||||||
|
|
||||||
const prevOrder = newIndex === 0 ?
|
const indexBefore = offset + newIndex - 1;
|
||||||
0 : newList[offset + newIndex - 1].tags[newTag].order;
|
const indexAfter = offset + newIndex;
|
||||||
const nextOrder = newIndex === newList.length ?
|
|
||||||
1 : newList[offset + newIndex].tags[newTag].order;
|
const prevOrder = indexBefore <= 0 ?
|
||||||
|
0 : newList[indexBefore].tags[newTag].order;
|
||||||
|
const nextOrder = indexAfter >= newList.length ?
|
||||||
|
1 : newList[indexAfter].tags[newTag].order;
|
||||||
|
|
||||||
metaData = {
|
metaData = {
|
||||||
order: (prevOrder + nextOrder) / 2.0,
|
order: (prevOrder + nextOrder) / 2.0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user