瀏覽代碼

feat: 优化一页的时候

gemercheung 1 年之前
父節點
當前提交
01e2b40bef
共有 1 個文件被更改,包括 5 次插入7 次删除
  1. 5 7
      src/core/Scene.js

+ 5 - 7
src/core/Scene.js

@@ -288,7 +288,7 @@ export default class Scene extends Mitt {
 
     console.log("slides", slides);
 
-    if (slides >= 1) {
+    if (slides >= 1 && total > 3) {
       for (var i = 0; i <= slides; i++) {
         (function (index, that) {
           setTimeout(function () {
@@ -298,18 +298,18 @@ export default class Scene extends Mitt {
             console.log(`Width: ${offset}`);
             if (index === slides) {
               console.log("last");
-              that.emit("submitScreenshot", isSaveJpg);
+              that.emit("submitScreenshot", true);
             }
           }, index * 500);
         })(i, this); // 传递当前迭代的索引i给setTimeout的回调函数
       }
     } else {
-      // 只有一个或0个
-      if (total >= 1 && total <= 3) {
+      // 只有一个
+      if (total >= 1) {
         console.log("total", total);
         this.player.floorplanControls.reset();
         this.screenshot(-0.3, 227);
-        this.emit("submitScreenshot");
+        this.emit("submitScreenshot", true);
       }
     }
   }
@@ -341,8 +341,6 @@ export default class Scene extends Mitt {
     // console.log("height", height);
   }
 
-
-
   onBindEvent = () => {
     window.addEventListener("resize", this.onResize, false);
   };