Remove unused OnInit lifecycle hook from ParticlesComponent and cleanup redundant comments.

This commit is contained in:
Teriuihi 2025-06-22 19:08:28 +02:00
parent 023ae809ef
commit c13b7077a7

View File

@ -1,4 +1,4 @@
import {AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatButtonModule} from '@angular/material/button'; import {MatButtonModule} from '@angular/material/button';
@ -49,7 +49,7 @@ import {MatSnackBar} from '@angular/material/snack-bar';
templateUrl: './particles.component.html', templateUrl: './particles.component.html',
styleUrl: './particles.component.scss' styleUrl: './particles.component.scss'
}) })
export class ParticlesComponent implements OnInit, AfterViewInit, OnDestroy { export class ParticlesComponent implements AfterViewInit, OnDestroy {
@ViewChild('rendererContainer') rendererContainer!: ElementRef; @ViewChild('rendererContainer') rendererContainer!: ElementRef;
@ViewChild('planeSlider') planeSlider!: ElementRef; @ViewChild('planeSlider') planeSlider!: ElementRef;
@ -63,13 +63,6 @@ export class ParticlesComponent implements OnInit, AfterViewInit, OnDestroy {
) { ) {
} }
/**
* Initialize component
*/
ngOnInit(): void {
// No initialization needed here
}
/** /**
* Initialize Three.js scene after view is initialized * Initialize Three.js scene after view is initialized
*/ */
@ -82,7 +75,6 @@ export class ParticlesComponent implements OnInit, AfterViewInit, OnDestroy {
* Clean up resources when component is destroyed * Clean up resources when component is destroyed
*/ */
ngOnDestroy(): void { ngOnDestroy(): void {
// Clean up event listeners
if (this.rendererService.renderer) { if (this.rendererService.renderer) {
this.inputHandlerService.cleanup(this.rendererService.renderer.domElement); this.inputHandlerService.cleanup(this.rendererService.renderer.domElement);
} }
@ -92,16 +84,9 @@ export class ParticlesComponent implements OnInit, AfterViewInit, OnDestroy {
* Initialize the 3D scene and all related components * Initialize the 3D scene and all related components
*/ */
private initializeScene(): void { private initializeScene(): void {
// Initialize renderer
this.rendererService.initializeRenderer(this.rendererContainer); this.rendererService.initializeRenderer(this.rendererContainer);
// Create player model
this.playerModelService.createPlayerModel(); this.playerModelService.createPlayerModel();
// Create intersection plane
this.intersectionPlaneService.createIntersectionPlane(); this.intersectionPlaneService.createIntersectionPlane();
// Initialize input handlers
this.inputHandlerService.initializeInputHandlers(this.rendererService.renderer.domElement); this.inputHandlerService.initializeInputHandlers(this.rendererService.renderer.domElement);
} }
@ -138,11 +123,7 @@ export class ParticlesComponent implements OnInit, AfterViewInit, OnDestroy {
*/ */
private animate(): void { private animate(): void {
requestAnimationFrame(this.animate.bind(this)); requestAnimationFrame(this.animate.bind(this));
// Update plane orientation based on camera position
this.intersectionPlaneService.updatePlaneOrientation(this.rendererService.camera); this.intersectionPlaneService.updatePlaneOrientation(this.rendererService.camera);
// Render the scene
this.rendererService.render(); this.rendererService.render();
} }