mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix multielements (#987)
This commit is contained in:
parent
0dc07135b7
commit
b603337c3f
3 changed files with 87 additions and 56 deletions
|
@ -2,6 +2,7 @@ import { ExcalidrawElement } from "./types";
|
|||
import { randomSeed } from "roughjs/bin/math";
|
||||
import { invalidateShapeForElement } from "../renderer/renderElement";
|
||||
import { globalSceneState } from "../scene";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
|
||||
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<
|
||||
Partial<TElement>,
|
||||
|
@ -18,6 +19,10 @@ export function mutateElement<TElement extends ExcalidrawElement>(
|
|||
) {
|
||||
const mutableElement = element as any;
|
||||
|
||||
if (typeof updates.points !== "undefined") {
|
||||
updates = { ...getSizeFromPoints(updates.points!), ...updates };
|
||||
}
|
||||
|
||||
for (const key in updates) {
|
||||
const value = (updates as any)[key];
|
||||
if (typeof value !== "undefined") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue