Add a reset camera button and implement default camera reset functionality
This commit is contained in:
parent
c3a7be82e9
commit
5284d498f3
|
|
@ -1,5 +1,10 @@
|
||||||
<div #rendererContainer class="renderer-container">
|
<div #rendererContainer class="renderer-container">
|
||||||
<div class="plane-controls-overlay">
|
<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()"
|
<button mat-mini-fab color="primary" (click)="togglePlaneLock()"
|
||||||
[matTooltip]="isPlaneLocked ? 'Unlock Plane' : 'Lock Plane'">
|
[matTooltip]="isPlaneLocked ? 'Unlock Plane' : 'Lock Plane'">
|
||||||
<mat-icon>{{ isPlaneLocked ? 'lock' : 'lock_open' }}</mat-icon>
|
<mat-icon>{{ isPlaneLocked ? 'lock' : 'lock_open' }}</mat-icon>
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,10 @@ export class RenderContainerComponent implements AfterViewInit, OnDestroy {
|
||||||
this.intersectionPlaneService.setPlaneLocked(newLockedState);
|
this.intersectionPlaneService.setPlaneLocked(newLockedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public resetCamera(): void {
|
||||||
|
this.rendererService.resetCamera();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current plane orientation
|
* Get the current plane orientation
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,16 @@ export class RendererService {
|
||||||
this.addLights();
|
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
|
* Adds lighting to the scene
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user