Преглед изворни кода

fix(core): only call the useCamera if the instance is camera

alvarosabu пре 2 година
родитељ
комит
17a8368e67
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      packages/tres/src/core/useInstanceCreator/index.ts

+ 2 - 1
packages/tres/src/core/useInstanceCreator/index.ts

@@ -24,7 +24,7 @@ const COLOR_KEYS = ['r', 'g', 'b']
  */
  */
 export function useInstanceCreator(prefix: string) {
 export function useInstanceCreator(prefix: string) {
   const { /* logMessage, */ logError } = useLogger()
   const { /* logMessage, */ logError } = useLogger()
-  const { pushCamera } = useCamera()
+
   /**
   /**
    * Process props to `.setAttribute` on instance.
    * Process props to `.setAttribute` on instance.
    *
    *
@@ -270,6 +270,7 @@ export function useInstanceCreator(prefix: string) {
               processProps(attrs, instance)
               processProps(attrs, instance)
               // If the instance is a camera, push it to the camera stack
               // If the instance is a camera, push it to the camera stack
               if (instance instanceof PerspectiveCamera || instance instanceof OrthographicCamera) {
               if (instance instanceof PerspectiveCamera || instance instanceof OrthographicCamera) {
+                const { pushCamera } = useCamera()
                 pushCamera(instance)
                 pushCamera(instance)
               }
               }