diff --git a/projects/editor/src/app/services/unit.service.ts b/projects/editor/src/app/services/unit.service.ts index 3e1a432a0726fa04e6cb6e133f2604f60d35af95..f589e9b6ed962358305ae94308fedc8097b788c9 100644 --- a/projects/editor/src/app/services/unit.service.ts +++ b/projects/editor/src/app/services/unit.service.ts @@ -209,6 +209,7 @@ export class UnitService { (newElementProperties as AudioProperties | VideoProperties | ImageProperties).src = mediaSrc; } + // Coordinates are given if an element is dragged directly into a cell if (coordinates) { newElementProperties.position = { ...(section.dynamicPositioning && { gridColumn: coordinates.x }), @@ -218,6 +219,12 @@ export class UnitService { } as PositionProperties; } + // Use z-index -1 for frames + newElementProperties.position = { + zIndex: elementType === 'frame' ? -1 : 0, + ...newElementProperties.position + } as PositionProperties; + section.addElement(ElementFactory.createElement({ type: elementType, position: PropertyGroupGenerators.generatePositionProps(newElementProperties.position),