Browse Source

freeze static objects

menduz 7 năm trước cách đây
mục cha
commit
62e3667134
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      src/Animations/babylon.runtimeAnimation.ts

+ 5 - 5
src/Animations/babylon.runtimeAnimation.ts

@@ -3,19 +3,19 @@
     // Static values to help the garbage collector
 
     // Quaternion
-    const _staticOffsetValueQuaternion: Readonly<Quaternion> = new Quaternion(0, 0, 0, 0);
+    const _staticOffsetValueQuaternion: Readonly<Quaternion> = Object.freeze(new Quaternion(0, 0, 0, 0));
 
     // Vector3
-    const _staticOffsetValueVector3: Readonly<Vector3> = Vector3.Zero();
+    const _staticOffsetValueVector3: Readonly<Vector3> = Object.freeze(Vector3.Zero());
 
     // Vector2
-    const _staticOffsetValueVector2: Readonly<Vector2> = Vector2.Zero();
+    const _staticOffsetValueVector2: Readonly<Vector2> = Object.freeze(Vector2.Zero());
 
     // Size
-    const _staticOffsetValueSize: Readonly<Size> = Size.Zero();
+    const _staticOffsetValueSize: Readonly<Size> = Object.freeze(Size.Zero());
 
     // Color3
-    const _staticOffsetValueColor3: Readonly<Color3> = Color3.Black();
+    const _staticOffsetValueColor3: Readonly<Color3> = Object.freeze(Color3.Black());
 
     /**
      * Defines a runtime animation