mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: restore on paste or lib import (#3558)
This commit is contained in:
parent
5ee8e8249c
commit
91ab7f36e2
2 changed files with 20 additions and 15 deletions
|
@ -1281,7 +1281,8 @@ class App extends React.Component<AppProps, AppState> {
|
|||
elements: readonly ExcalidrawElement[];
|
||||
position: { clientX: number; clientY: number } | "cursor" | "center";
|
||||
}) => {
|
||||
const [minX, minY, maxX, maxY] = getCommonBounds(opts.elements);
|
||||
const elements = restoreElements(opts.elements);
|
||||
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
|
||||
|
||||
const elementsCenterX = distance(minX, maxX) / 2;
|
||||
const elementsCenterY = distance(minY, maxY) / 2;
|
||||
|
@ -1311,7 +1312,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
const [gridX, gridY] = getGridPoint(dx, dy, this.state.gridSize);
|
||||
|
||||
const oldIdToDuplicatedId = new Map();
|
||||
const newElements = opts.elements.map((element) => {
|
||||
const newElements = elements.map((element) => {
|
||||
const newElement = duplicateElement(
|
||||
this.state.editingGroupId,
|
||||
groupIdMap,
|
||||
|
@ -1328,11 +1329,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
...this.scene.getElementsIncludingDeleted(),
|
||||
...newElements,
|
||||
];
|
||||
fixBindingsAfterDuplication(
|
||||
nextElements,
|
||||
opts.elements,
|
||||
oldIdToDuplicatedId,
|
||||
);
|
||||
fixBindingsAfterDuplication(nextElements, elements, oldIdToDuplicatedId);
|
||||
|
||||
this.scene.replaceAllElements(nextElements);
|
||||
this.history.resumeRecording();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue