Skip to content

Commit 97591ba

Browse files
committed
fix: handleResize call order
1 parent bed64dc commit 97591ba

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/components/BookScene.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class BookScene {
4040
private closedCameraZ: number = 4;
4141

4242
private initialCameraOffset = isDev() ? new THREE.Vector3(0, 0, 0) : new THREE.Vector3(5, -5, -4);
43-
private initialCameraUp = isDev() ? new THREE.Vector3(0, 1, 0) : new THREE.Vector3(-2, 3, 3).normalize();
43+
private initialCameraUp = isDev() ? new THREE.Vector3(0, 1, 0) : new THREE.Vector3(-2, 3, 3);
4444

4545
public openingAnimationStatus: 'none' | 'playing' | 'played' = isDev() ? 'played' : 'none';
4646

@@ -57,6 +57,18 @@ export class BookScene {
5757
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, this.maxPixelRatio));
5858

5959

60+
this.videoOverlayManager = new VideoOverlayManager(() => { }, () => { });
61+
62+
this.iconManager = new IconManager(
63+
this.scene,
64+
this.camera,
65+
this.container,
66+
this.renderer,
67+
this.videoOverlayManager
68+
);
69+
70+
this.handleResize(); //FIXME: 现在这个 handleResize 不可以放在后面执行
71+
6072
this.renderer.setSize(container.clientWidth, container.clientHeight);
6173
this.renderer.toneMapping = THREE.NoToneMapping;
6274
this.renderer.localClippingEnabled = true;
@@ -75,20 +87,7 @@ export class BookScene {
7587
// const axesHelper = new THREE.AxesHelper(5);
7688
// this.scene.add(axesHelper);
7789

78-
this.videoOverlayManager = new VideoOverlayManager(() => { }, () => { });
79-
80-
this.iconManager = new IconManager(
81-
this.scene,
82-
this.camera,
83-
this.container,
84-
this.renderer,
85-
this.videoOverlayManager
86-
);
87-
88-
8990
window.addEventListener('resize', () => this.handleResize());
90-
this.handleResize();
91-
9291
}
9392

9493
private setUpLight() {

0 commit comments

Comments
 (0)