mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
remove closures from mutateElement, get rid of the element spreading (#902)
This commit is contained in:
parent
13b838117c
commit
83a2f5de28
10 changed files with 218 additions and 196 deletions
|
@ -1,6 +1,7 @@
|
|||
import { AppState } from "./types";
|
||||
import { ExcalidrawElement } from "./element/types";
|
||||
import { clearAppStatePropertiesForHistory } from "./appState";
|
||||
import { newElementWith } from "./element/mutateElement";
|
||||
|
||||
type Result = {
|
||||
appState: AppState;
|
||||
|
@ -18,13 +19,14 @@ export class SceneHistory {
|
|||
) {
|
||||
return JSON.stringify({
|
||||
appState: clearAppStatePropertiesForHistory(appState),
|
||||
elements: elements.map(element => ({
|
||||
...element,
|
||||
points:
|
||||
appState.multiElement && appState.multiElement.id === element.id
|
||||
? element.points.slice(0, -1)
|
||||
: element.points,
|
||||
})),
|
||||
elements: elements.map(element =>
|
||||
newElementWith(element, {
|
||||
points:
|
||||
appState.multiElement && appState.multiElement.id === element.id
|
||||
? element.points.slice(0, -1)
|
||||
: element.points,
|
||||
}),
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue