mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
remove most setState({}) (#959)
This commit is contained in:
parent
e1e2249f57
commit
35ce1729cc
5 changed files with 149 additions and 95 deletions
|
@ -1,6 +1,7 @@
|
|||
import { ExcalidrawElement } from "./types";
|
||||
import { randomSeed } from "roughjs/bin/math";
|
||||
import { invalidateShapeForElement } from "../renderer/renderElement";
|
||||
import { globalSceneState } from "../scene";
|
||||
|
||||
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<
|
||||
Partial<TElement>,
|
||||
|
@ -33,6 +34,8 @@ export function mutateElement<TElement extends ExcalidrawElement>(
|
|||
|
||||
mutableElement.version++;
|
||||
mutableElement.versionNonce = randomSeed();
|
||||
|
||||
globalSceneState.informMutation();
|
||||
}
|
||||
|
||||
export function newElementWith<TElement extends ExcalidrawElement>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue