Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GengineJS committed Dec 5, 2024
1 parent 959f86e commit c48925d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cocos/3d/reflection-probe/reflection-probe-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,9 @@ export class ReflectionProbe extends Component {
if (EDITOR) {
ReflectionProbeManager.probeManager.registerEvent();
}
screen.on('window-resize', this._handleResize$, this);
screen.on('fullscreen-change', this._handleResize$, this);
}

private _handleResize$(): void {
private _handleResize$ (): void {
if (this.probe && this.sourceCamera && this.probeType === ProbeType.PLANAR) {
this.probe.renderPlanarReflection(this.sourceCamera.camera);
}
Expand All @@ -342,12 +340,16 @@ export class ReflectionProbe extends Component {
ReflectionProbeManager.probeManager.onUpdateProbes();
this._probe.enable();
}
screen.on('window-resize', this._handleResize$, this);
screen.on('fullscreen-change', this._handleResize$, this);
}
onDisable (): void {
if (this._probe) {
ReflectionProbeManager.probeManager.unregister(this._probe);
this._probe.disable();
}
screen.off('window-resize', this._handleResize$, this);
screen.off('fullscreen-change', this._handleResize$, this);
}

public start (): void {
Expand Down

0 comments on commit c48925d

Please sign in to comment.