Skip to content

Commit 3e0d0e5

Browse files
committed
limit the update frecuency
1 parent b22c67b commit 3e0d0e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/nodes/preview/ScenePreview.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class ScenePreviewNode extends WinNode {
1616
protected rotationSpeedSlider:DraggableValue;
1717
protected objTypeCombo:ComboBox;
1818
protected errorMaterial:MeshBasicMaterial;
19+
protected updateWaitInterval = 0;
1920

2021
constructor( protected scene:ThreeScene ) {
2122

@@ -25,8 +26,8 @@ export class ScenePreviewNode extends WinNode {
2526

2627
const materialSlots = [
2728
new MaterialProperty(0),
28-
new MaterialProperty(1),
29-
new MaterialProperty(2),
29+
// new MaterialProperty(1),
30+
// new MaterialProperty(2),
3031
]
3132

3233
super("Scene Preview", Theme.config.groupOutput, [
@@ -62,9 +63,14 @@ export class ScenePreviewNode extends WinNode {
6263
}
6364

6465
override update(): void {
65-
66-
this.compileMaterialAndAdd( 0 )
6766

67+
clearInterval( this.updateWaitInterval );
68+
69+
this.updateWaitInterval = setTimeout(()=>{
70+
71+
this.compileMaterialAndAdd( 0 )
72+
73+
}, 400);
6874
}
6975

7076
protected compileMaterialAndAdd( materialIndex:number )

0 commit comments

Comments
 (0)