Change displayed tab when a new one is opened
All checks were successful
E2E Testing / test (push) Successful in 1m25s

This commit is contained in:
Sebastian Böckelmann 2024-02-12 18:34:23 +01:00
parent 125b2a7ece
commit 8f45063d4f
2 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
<mat-tab-group>
<mat-tab-group [(selectedIndex)]="activeTab">
<mat-tab *ngFor="let modelComponent of gameModelComponents">
<ng-template mat-tab-label>
<mat-icon class="example-tab-icon unsaved" *ngIf="modelComponent.type === ModelComponentType.SCRIPTACCOUNT" [ngClass]="modelComponent.unsaved? 'unsaved':'saved'">inventory_2</mat-icon>

View File

@ -15,10 +15,12 @@ import {Transition} from "../game-model/gamesystems/Transition";
export class EditorComponent {
gameModelComponents: ModelComponent[] = [];
@Output("onModelNameUpdate") onModelNameUpdateEmitter = new EventEmitter<boolean>();
activeTab: number = this.gameModelComponents.length;
openGameModelComponent(gameModelComponent: ModelComponent) {
if(!this.gameModelComponents.includes(gameModelComponent)) {
this.gameModelComponents.push(gameModelComponent);
this.activeTab = this.gameModelComponents.length;
}
}