Skip to content
Snippets Groups Projects
Commit 911100f1 authored by rhenck's avatar rhenck
Browse files

Improve frame element compat handling

Better solution without an extra variable.
parent 6903de6f
No related branches found
No related tags found
No related merge requests found
......@@ -20,14 +20,16 @@ export class FrameElement extends UIElement implements PositionedElement, Surfac
constructor(serializedElement: Partial<UIElement>) {
super(serializedElement);
Object.assign(this, serializedElement);
const newSerializedElement = serializedElement;
if (newSerializedElement.positionProps && newSerializedElement.positionProps.zIndex === undefined) {
newSerializedElement.positionProps.zIndex = -1;
this.positionProps = initPositionedElement(serializedElement);
this.surfaceProps = initSurfaceElement(serializedElement);
if (serializedElement.zIndex === undefined &&
serializedElement.positionProps?.zIndex === undefined) {
this.positionProps.zIndex = -1;
}
this.positionProps = initPositionedElement(newSerializedElement);
this.surfaceProps = initSurfaceElement(newSerializedElement);
this.surfaceProps.backgroundColor =
newSerializedElement.surfaceProps?.backgroundColor as string ||
serializedElement.surfaceProps?.backgroundColor as string ||
'transparent';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment