Skip to content
Snippets Groups Projects
Commit 76b06912 authored by rhenck's avatar rhenck
Browse files

Add Z-Index property to elements

This defines the elements priority when stacking elements on the canvas. 
Directly maps to the CSS property.

Also show tooltip on the input to explain what it is for.
parent 877db8c3
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ import { MatDialogModule } from '@angular/material/dialog'; ...@@ -18,6 +18,7 @@ import { MatDialogModule } from '@angular/material/dialog';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { ButtonComponent } from './element-components/button.component'; import { ButtonComponent } from './element-components/button.component';
import { CorrectionComponent } from './element-components/compound-components/correction.component'; import { CorrectionComponent } from './element-components/compound-components/correction.component';
...@@ -78,7 +79,8 @@ import { DropdownComponent } from './element-components/dropdown.component'; ...@@ -78,7 +79,8 @@ import { DropdownComponent } from './element-components/dropdown.component';
CheckboxComponent, CheckboxComponent,
DropdownComponent, DropdownComponent,
CorrectionComponent, CorrectionComponent,
MatSnackBarModule MatSnackBarModule,
MatTooltipModule
] ]
}) })
export class SharedModule { } export class SharedModule { }
...@@ -22,6 +22,7 @@ export interface UnitUIElement { ...@@ -22,6 +22,7 @@ export interface UnitUIElement {
id: string; id: string;
xPosition: number; xPosition: number;
yPosition: number; yPosition: number;
zIndex: number
width: number; width: number;
height: number; height: number;
backgroundColor: string; backgroundColor: string;
......
...@@ -49,6 +49,7 @@ export class CanvasDragOverlayComponent implements OnInit { ...@@ -49,6 +49,7 @@ export class CanvasDragOverlayComponent implements OnInit {
border: this._selected ? '2px solid' : '', border: this._selected ? '2px solid' : '',
width: `${this.element.width}px`, width: `${this.element.width}px`,
height: `${this.element.height}px`, height: `${this.element.height}px`,
'z-index': `${this.element.zIndex}`,
left: `${this.element.xPosition.toString()}px`, left: `${this.element.xPosition.toString()}px`,
top: `${this.element.yPosition.toString()}px` top: `${this.element.yPosition.toString()}px`
}; };
......
...@@ -102,6 +102,12 @@ ...@@ -102,6 +102,12 @@
<input matInput type="number" [value]="combinedProperties.yPosition" <input matInput type="number" [value]="combinedProperties.yPosition"
(input)="updateModel('yPosition', $any($event.target).value)"> (input)="updateModel('yPosition', $any($event.target).value)">
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="combinedProperties.hasOwnProperty('zIndex')">
<mat-label>Z-Index</mat-label>
<input matInput type="number" [value]="combinedProperties.zIndex"
(input)="updateModel('zIndex', $any($event.target).value)"
matTooltip="Priorität beim Stapeln von Elementen. Der höhere Index erscheint vorne.">
</mat-form-field>
</div> </div>
</mat-tab> </mat-tab>
......
...@@ -6,7 +6,6 @@ import { ...@@ -6,7 +6,6 @@ import {
VideoElement VideoElement
} from '../../../../common/unit'; } from '../../../../common/unit';
export function createUnit(): Unit { export function createUnit(): Unit {
return { return {
pages: [] pages: []
...@@ -37,6 +36,7 @@ export function createUnitUIElement(type: string): UnitUIElement { ...@@ -37,6 +36,7 @@ export function createUnitUIElement(type: string): UnitUIElement {
id: 'id_placeholder', id: 'id_placeholder',
xPosition: 0, xPosition: 0,
yPosition: 0, yPosition: 0,
zIndex: 0,
width: 180, width: 180,
height: 60, height: 60,
backgroundColor: 'lightgrey', backgroundColor: 'lightgrey',
......
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