Skip to content

Commit

Permalink
update: Sat 06 Apr 2024 20:27:59 CEST
Browse files Browse the repository at this point in the history
  • Loading branch information
cophilot committed Apr 6, 2024
1 parent 8b063e1 commit 0f3397f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/app/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
alt="home"
class="smallLogo backgroundBox"
(click)="getObjectService().setSelectedObject(null)"
*ngIf="getSettingsService().isLogoVisible()"
/>
<i
class="bi bi-gear settings-button backgroundBox"
(click)="goToSettings()"
*ngIf="getSettingsService().isSettingsVisible()"
></i>
<app-coordinate-system></app-coordinate-system>
<app-object
Expand Down
20 changes: 8 additions & 12 deletions src/app/play-bar/play-bar.component.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<div class="bg glass" cdkDrag>
<div class="container" *ngIf="isVisible">
<app-my-icon
[name]="'x' + getZoomFactor().toFixed(2)"
[textIcon]="true"
[size]="16"
(click)="resetZoom()"
description="Reset zoom"
name="bi bi-gear"
(click)="goToSettings()"
description="Go to settings"
></app-my-icon>
<app-my-icon
name="bi bi-zoom-in"
description="This is a test"
(click)="zoomIn()"
(dblclick)="zoomIn(true)"
description="Zoom in"
></app-my-icon>
</div>
<div class="container" *ngIf="isVisible">
<app-my-icon
name="bi bi-zoom-in"
description="This is a test"
(click)="zoomIn()"
(dblclick)="zoomIn(true)"
description="Zoom in"
[name]="'x' + getZoomFactor().toFixed(2)"
[textIcon]="true"
[size]="16"
(click)="resetZoom()"
description="Reset zoom"
></app-my-icon>
<app-my-icon
name="bi bi-zoom-out"
description="This is a test"
(click)="zoomOut()"
(dblclick)="zoomOut(true)"
description="Zoom out"
Expand Down
8 changes: 7 additions & 1 deletion src/app/play-bar/play-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CdkDrag } from '@angular/cdk/drag-drop';
import { NgIf } from '@angular/common';
import { MyIconComponent } from '../my-icon/my-icon.component';
import { ScaleService } from '../service/scale.service';
import { Router } from '@angular/router';

@Component({
selector: 'app-play-bar',
Expand All @@ -19,7 +20,8 @@ export class PlayBarComponent {

constructor(
private moveService: MoveService,
private objectService: ObjectService
private objectService: ObjectService,
private router: Router
) {}

nextStep() {
Expand Down Expand Up @@ -124,4 +126,8 @@ export class PlayBarComponent {
getZoomFactor() {
return ScaleService.currentScale;
}

goToSettings() {
this.router.navigate(['settings']);
}
}
28 changes: 28 additions & 0 deletions src/app/service/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export class SettingsService {
private static gridSize = 50;
private static showObjectNames = true;
private static showVelocityArrow = true;
private static showLogo = true;
private static showSettings = true;

static init() {
if (this.isInit) {
Expand All @@ -21,6 +23,8 @@ export class SettingsService {
this.gridSize = settings.gridSize;
this.showObjectNames = settings.showObjectNames;
this.showVelocityArrow = settings.showVelocityArrow;
this.showLogo = settings.showLogo;
this.showSettings = settings.showSettings;
}
this.isInit = true;
}
Expand All @@ -31,6 +35,8 @@ export class SettingsService {
gridSize: this.gridSize,
showObjectNames: this.showObjectNames,
showVelocityArrow: this.showVelocityArrow,
showLogo: this.showLogo,
showSettings: this.showSettings,
});
}

Expand Down Expand Up @@ -61,6 +67,28 @@ export class SettingsService {
this.saveSettings();
}

static isLogoVisible(): boolean {
this.init();
return this.showLogo;
}

static toggleLogoVisibility(): void {
this.init();
this.showLogo = !this.showLogo;
this.saveSettings();
}

static isSettingsVisible(): boolean {
this.init();
return this.showSettings;
}

static toggleSettingsVisibility(): void {
this.init();
this.showSettings = !this.showSettings;
this.saveSettings();
}

static toggleGridSize(): void {
this.init();

Expand Down
25 changes: 25 additions & 0 deletions src/app/settings/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ <h2>View</h2>
}}
</button>
</div>
<div class="row">
<p class="label">Logo</p>
<button class="actionButton" (click)="getSettings().toggleLogoVisibility()">
{{ getSettings().isLogoVisible() ? "ON" : "OFF" }}
</button>
</div>
<div class="row">
<p class="label">Settings Icon</p>
<button
class="actionButton"
(click)="getSettings().toggleSettingsVisibility()"
>
{{ getSettings().isSettingsVisible() ? "ON" : "OFF" }}
</button>
</div>
<h2>Behavior</h2>
<div class="row">
<p class="label">Collision Mode</p>
<button
class="actionButton"
(click)="getSettings().toggleSettingsVisibility()"
>
{{ getSettings().isSettingsVisible() ? "ON" : "OFF" }}
</button>
</div>
<h2>Examples</h2>
<div class="row">
<p class="label">Earth & Moon</p>
Expand Down

0 comments on commit 0f3397f

Please sign in to comment.