mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-20 04:34:20 +01:00
generate real fractional index after z-index actions
This commit is contained in:
@@ -315,11 +315,11 @@ class Scene {
|
||||
"insertElementAtIndex can only be called with index >= 0",
|
||||
);
|
||||
}
|
||||
const nextElements = [
|
||||
const nextElements = normalizeFractionalIndicies([
|
||||
...this.elements.slice(0, index),
|
||||
...elements,
|
||||
...this.elements.slice(index),
|
||||
];
|
||||
]);
|
||||
|
||||
this.replaceAllElements(nextElements);
|
||||
}
|
||||
@@ -328,7 +328,9 @@ class Scene {
|
||||
if (element.frameId) {
|
||||
this.insertElementAtIndex(element, this.getElementIndex(element.frameId));
|
||||
} else {
|
||||
this.replaceAllElements([...this.elements, element]);
|
||||
this.replaceAllElements(
|
||||
normalizeFractionalIndicies([...this.elements, element]),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user