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