fix fractional indices on adding new elements

This commit is contained in:
Ryan Di 2023-12-05 23:04:17 +08:00
parent 5bc23d6dee
commit 7dfba985f9
4 changed files with 62 additions and 37 deletions

View file

@ -235,9 +235,9 @@ const getTargetElementsMap = <T extends ExcalidrawElement>(
) => {
return indices.reduce((acc, index) => {
const element = elements[index];
acc[element.id] = element;
acc.set(element.id, element);
return acc;
}, {} as Record<string, ExcalidrawElement>);
}, new Map<string, ExcalidrawElement>());
};
const shiftElementsByOne = (