Add a reset camera button and implement default camera reset functionality

This commit is contained in:
Teriuihi 2025-06-22 20:53:11 +02:00
parent c3a7be82e9
commit 5284d498f3
3 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,10 @@
<div #rendererContainer class="renderer-container">
<div class="plane-controls-overlay">
<button mat-mini-fab color="primary" (click)="resetCamera()"
matTooltip="Reset camera">
<mat-icon>location_searching</mat-icon>
</button>
<button mat-mini-fab color="primary" (click)="togglePlaneLock()"
[matTooltip]="isPlaneLocked ? 'Unlock Plane' : 'Lock Plane'">
<mat-icon>{{ isPlaneLocked ? 'lock' : 'lock_open' }}</mat-icon>

View File

@ -82,6 +82,10 @@ export class RenderContainerComponent implements AfterViewInit, OnDestroy {
this.intersectionPlaneService.setPlaneLocked(newLockedState);
}
public resetCamera(): void {
this.rendererService.resetCamera();
}
/**
* Get the current plane orientation
*/

View File

@ -54,6 +54,16 @@ export class RendererService {
this.addLights();
}
/**
* Resets the camera to its default position and orientation.
*/
public resetCamera(): void {
this.camera.position.set(-1, 2, 3);
this.camera.lookAt(0, 1, 0);
this.controls.target.set(0, 1, 0);
this.controls.update();
}
/**
* Adds lighting to the scene
*/