From: Vincent Vanwaelscappel Date: Tue, 6 May 2025 14:24:01 +0000 (+0200) Subject: wait #7418 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=11ea999ce8a34dacce3c5968fb5f15dc09cf725d;p=fluidbook-html5.git wait #7418 @1.5 --- diff --git a/js/libs/fluidbook/fluidbook.3dflip.js b/js/libs/fluidbook/fluidbook.3dflip.js index 8af72507..87fdc753 100644 --- a/js/libs/fluidbook/fluidbook.3dflip.js +++ b/js/libs/fluidbook/fluidbook.3dflip.js @@ -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; } }); }, diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index ceb0237c..409a9158 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -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)); } }, - - };