瀏覽代碼

修改默认旋转

bill 11 月之前
父節點
當前提交
6c7b22433c
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 1 0
      src/sdk/sdk.ts
  2. 10 1
      src/views/merge/index.vue

+ 1 - 0
src/sdk/sdk.ts

@@ -41,6 +41,7 @@ export type SceneModel = ToChangeAPI<SceneModelAttrs> & {
   enterRotateMode: () => void;
   enterMoveMode: () => void;
   leaveTransform: () => void;
+  getDefaultRotation: () => SceneLocalPos
   enterAlignment: () => void;
   leaveAlignment: () => void;
   enterScaleSet: () => ScaleSet;

+ 10 - 1
src/views/merge/index.vue

@@ -128,11 +128,20 @@ watch(
 
 const reset = async () => {
   if (custom.currentModel && (await Dialog.confirm("确定恢复默认?此操作无法撤销"))) {
-    Object.assign(custom.currentModel, defaultFuseModelAttrs);
+    const rotation = getSceneModel(custom.currentModel)!.getDefaultRotation();
+    Object.assign(custom.currentModel, {
+      ...defaultFuseModelAttrs,
+      rotation: {
+        x: rotation.x,
+        y: rotation.y,
+        z: rotation.z,
+      },
+    });
     await nextTick();
     custom.currentModel && (custom.currentModel.bottom = 0);
   }
 };
+
 useViewStack(() =>
   togetherCallback([
     showLeftPanoStack.push(ref(true)),