mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: always re-generate index of defined moved elements (#8040)
This commit is contained in:
parent
2f9526da24
commit
eddbe55f50
5 changed files with 151 additions and 125 deletions
|
@ -133,27 +133,11 @@ const getMovedIndicesGroups = (
|
|||
let i = 0;
|
||||
|
||||
while (i < elements.length) {
|
||||
if (
|
||||
movedElements.has(elements[i].id) &&
|
||||
!isValidFractionalIndex(
|
||||
elements[i]?.index,
|
||||
elements[i - 1]?.index,
|
||||
elements[i + 1]?.index,
|
||||
)
|
||||
) {
|
||||
if (movedElements.has(elements[i].id)) {
|
||||
const indicesGroup = [i - 1, i]; // push the lower bound index as the first item
|
||||
|
||||
while (++i < elements.length) {
|
||||
if (
|
||||
!(
|
||||
movedElements.has(elements[i].id) &&
|
||||
!isValidFractionalIndex(
|
||||
elements[i]?.index,
|
||||
elements[i - 1]?.index,
|
||||
elements[i + 1]?.index,
|
||||
)
|
||||
)
|
||||
) {
|
||||
if (!movedElements.has(elements[i].id)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue