From 6a9ec394fb8419e87eee74c300c86963d6c6e1dc Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Thu, 23 May 2024 17:33:28 +0200
Subject: [PATCH] [editor] Fix frame's z-index initialiation

Now it correctly has -1 after initialization.
---
 projects/editor/src/app/services/unit.service.ts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/projects/editor/src/app/services/unit.service.ts b/projects/editor/src/app/services/unit.service.ts
index 3e1a432a0..f589e9b6e 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),
-- 
GitLab