mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Revert aspect ratio fix with element size limits and chk (#9131)
This commit is contained in:
parent
26f02bebea
commit
77dc055d81
5 changed files with 161 additions and 5 deletions
|
@ -206,6 +206,25 @@ const restoreElementWithProperties = <
|
|||
"customData" in extra ? extra.customData : element.customData;
|
||||
}
|
||||
|
||||
// NOTE (mtolmacs): This is a temporary check to detect extremely large
|
||||
// element position or sizing
|
||||
if (
|
||||
element.x < -1e6 ||
|
||||
element.x > 1e6 ||
|
||||
element.y < -1e6 ||
|
||||
element.y > 1e6 ||
|
||||
element.width < -1e6 ||
|
||||
element.width > 1e6 ||
|
||||
element.height < -1e6 ||
|
||||
element.height > 1e6
|
||||
) {
|
||||
console.error(
|
||||
`Restore element with properties size or position is too large ${JSON.stringify(
|
||||
element,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
// spread the original element properties to not lose unknown ones
|
||||
// for forward-compatibility
|
||||
|
@ -220,6 +239,25 @@ const restoreElementWithProperties = <
|
|||
const restoreElement = (
|
||||
element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>,
|
||||
): typeof element | null => {
|
||||
// NOTE (mtolmacs): This is a temporary check to detect extremely large
|
||||
// element position or sizing
|
||||
if (
|
||||
element.x < -1e6 ||
|
||||
element.x > 1e6 ||
|
||||
element.y < -1e6 ||
|
||||
element.y > 1e6 ||
|
||||
element.width < -1e6 ||
|
||||
element.width > 1e6 ||
|
||||
element.height < -1e6 ||
|
||||
element.height > 1e6
|
||||
) {
|
||||
console.error(
|
||||
`Restore element size or position is too large ${JSON.stringify(
|
||||
element,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
switch (element.type) {
|
||||
case "text":
|
||||
let fontSize = element.fontSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue