compare to undefined directly
This commit is contained in:
parent
2dc84f04be
commit
8a106dde57
@ -24,13 +24,13 @@ export const mutateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||||||
// (see https://github.com/microsoft/TypeScript/issues/21732)
|
// (see https://github.com/microsoft/TypeScript/issues/21732)
|
||||||
const { points } = updates as any;
|
const { points } = updates as any;
|
||||||
|
|
||||||
if (typeof points !== "undefined") {
|
if (points !== undefined) {
|
||||||
updates = { ...getSizeFromPoints(points), ...updates };
|
updates = { ...getSizeFromPoints(points), ...updates };
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in updates) {
|
for (const key in updates) {
|
||||||
const value = (updates as any)[key];
|
const value = (updates as any)[key];
|
||||||
if (typeof value !== "undefined") {
|
if (value !== undefined) {
|
||||||
if (
|
if (
|
||||||
(element as any)[key] === value &&
|
(element as any)[key] === value &&
|
||||||
// if object, always update in case its deep prop was mutated
|
// if object, always update in case its deep prop was mutated
|
||||||
@ -72,9 +72,9 @@ export const mutateElement = <TElement extends Mutable<ExcalidrawElement>>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof updates.height !== "undefined" ||
|
updates.height !== undefined ||
|
||||||
typeof updates.width !== "undefined" ||
|
updates.width !== undefined ||
|
||||||
typeof points !== "undefined"
|
points !== undefined
|
||||||
) {
|
) {
|
||||||
invalidateShapeForElement(element);
|
invalidateShapeForElement(element);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user