瀏覽代碼

fix(core): check is function rotateAxis is defined

Madjid Taha 2 年之前
父節點
當前提交
24789c7ab6
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      packages/tres/src/core/useInstanceCreator/index.ts

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

@@ -49,7 +49,8 @@ export function useInstanceCreator(prefix: string) {
             transformAxis = camelKey.substring(vecProps.length)
             if (!VECTOR3_AXIS.includes(transformAxis)) {
               logError(
-                `There was an error setting ${key} property, ${transformAxis} is not a valid axis for ${transformProps}`,
+                `There was an error setting ${key} property`,
+                `${transformAxis} is not a valid axis for ${transformProps}`,
               )
             }
           }
@@ -74,7 +75,7 @@ export function useInstanceCreator(prefix: string) {
           // if it doesn't check if props is rotation
           if (isDefined(instance[transformProps][`set${transformAxis}`])) {
             instance[transformProps][`set${transformAxis}`](value)
-          } else if (transformProps === 'rotation') {
+          } else if (isDefined(instance[`rotate${transformAxis}`])) {
             instance[`rotate${transformAxis}`](value)
           }
         } else {