]> _ Git - fluidbook-html5.git/commitdiff
wait #7418 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 May 2025 14:24:01 +0000 (16:24 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 6 May 2025 14:24:01 +0000 (16:24 +0200)
js/libs/fluidbook/fluidbook.3dflip.js
js/libs/fluidbook/fluidbook.js

index 8af7250722ee3c2f8e5afe24c13ab1969e7155ad..87fdc7532de4267abe883a412169d41562ad40ca 100644 (file)
@@ -417,34 +417,37 @@ Fluidbook3DFlip.prototype = {
         var timeScale = 1;
         $('body').addClass('perftest');
 
-        if (this.fluidbook.shortLoading) {
+        this.performancesTestRunning=true;
+        if (this.fluidbook.shortLoading || this.performancesMode !== 'performancesTest') {
             console.log('No perf test', (Date.now() - $this.fluidbook.splash.initDate) / 1000)
-            callback();
-            timeScale = 0.01;
             _cb = function () {
+                callback();
                 console.log('After first fake turn', (Date.now() - $this.fluidbook.splash.initDate) / 1000)
-            };
+            }
+            timeScale = 0;
         } else {
-            if (this.performancesMode !== 'performancesTest') {
-                console.log('no perf test');
-                _cb = function () {
-                    callback();
-                }
-                timeScale = 0.01;
-            } else {
-                _cb = function () {
-                    $this.performancesEndTime = new Date();
-                    $this.adjustPerformancesSettings(callback);
-                }
+            _cb = function () {
+                $this.performancesEndTime = new Date();
+                $this.adjustPerformancesSettings(callback);
             }
         }
 
-        this.prepareTurn({flip: [1, 2]}, function () {
+        let playTurn = function () {
+            console.log('First turn prepared', (Date.now() - $this.fluidbook.splash.initDate) / 1000)
             $this.playTurn(1, function () {
+                console.log('First turn done', (Date.now() - $this.fluidbook.splash.initDate) / 1000);
                 _cb();
                 $('body').removeClass('perftest');
-            }, timeScale);
-        });
+            }, timeScale, 0);
+        };
+
+        if (this.fluidbook.shortLoading) {
+            playTurn();
+        } else {
+            this.prepareTurn({flip: [1, 2]}, function () {
+                playTurn();
+            });
+        }
     },
 
     adjustPerformancesSettings: function (callback) {
@@ -560,7 +563,7 @@ Fluidbook3DFlip.prototype = {
         }, enter);
     },
 
-    initTurn: function (dir) {
+    initTurn: function (dir,quick) {
         this.turnRunning = true;
 
         this.tlname = dir === 1 ? 'right' : 'left';
@@ -571,19 +574,32 @@ Fluidbook3DFlip.prototype = {
         this.progressAnimation(0);
         this.animate(false);
 
+        console.log('First turn animated', (Date.now() - this.fluidbook.splash.initDate) / 1000);
+
         this.resize();
     },
 
     playTurn: function (dir, callback, timeScale, delay) {
+        var $this = this;
+        console.log('First turn start', (Date.now() - $this.fluidbook.splash.initDate) / 1000);
+
+
         if (!this.turnRunning) {
             this.initTurn(dir);
         }
+        console.log('First turn inited', (Date.now() - $this.fluidbook.splash.initDate) / 1000);
 
         if (timeScale === undefined) {
             timeScale = 1;
         }
 
-        var $this = this;
+        if (timeScale === 0) {
+            this.progressAnimation(0);
+            $this.progressAnimation(1);
+            callback();
+            console.log('First turn end', (Date.now() - $this.fluidbook.splash.initDate) / 1000);
+            return;
+        }
 
         if (delay === undefined) {
             delay = this.fluidbook.support.iOS ? 0.15 : 0.06;
@@ -605,7 +621,6 @@ Fluidbook3DFlip.prototype = {
                 setTimeout(function () {
                     $this.turnRunning = false;
                 }, 4);
-                //$this._callbackAfterNextRender = callback;
             }
         });
     },
index ceb0237c8e0106e98dcbc6c770094321305a35d4..409a9158f0fcfeafa2d25be6bae314af1a8b5c20 100644 (file)
@@ -706,7 +706,6 @@ Fluidbook.prototype = {
             }
         }
 
-
         var s = $("#shadow,#edges");
 
         var s_in = [];
@@ -1313,6 +1312,4 @@ Fluidbook.prototype = {
             window.location = 'mailto:tech@fluidbook.com?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(JSON.stringify(o));
         }
     },
-
-
 };