restore polygon state on type conversions

This commit is contained in:
dwelle 2025-05-10 20:09:07 +02:00
parent 7c3190d4bb
commit 54b124c4f4

View File

@ -460,6 +460,7 @@ export const newLinearElement = (
opts: {
type: ExcalidrawLinearElement["type"];
points?: ExcalidrawLinearElement["points"];
polygon?: ExcalidrawLineElement["polygon"];
} & ElementConstructorOpts,
): NonDeleted<ExcalidrawLinearElement> => {
const element = {
@ -475,7 +476,7 @@ export const newLinearElement = (
if (isLineElement(element)) {
const lineElement: NonDeleted<ExcalidrawLineElement> = {
...element,
polygon: false,
polygon: opts.polygon ?? false,
};
return lineElement;