From bed240348f4ee05259fbb50deea7948ba823c4e3 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 21 Jun 2021 18:52:29 +0200 Subject: [PATCH] wip #4550 @1 --- js/libs/fluidbook/fluidbook.loader.js | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.loader.js b/js/libs/fluidbook/fluidbook.loader.js index 690c648d..37924046 100644 --- a/js/libs/fluidbook/fluidbook.loader.js +++ b/js/libs/fluidbook/fluidbook.loader.js @@ -347,7 +347,7 @@ FluidbookLoader.prototype = { }, addCLinks: function (pageNr) { - var $this=this; + var $this = this; var page = $("#page_" + pageNr); $.each(['clinks', 'ctlinks'], function (k, cont) { var normal = $(page).children('.' + cont + '[data-blendmode="normal"]'); @@ -450,8 +450,22 @@ FluidbookLoader.prototype = { this.backgrounds[page] = this.loadImage(url, null, null, null, page, callback); }, needSeparateTextures: function (page) { - return this.fluidbook.settings.clinks[page].indexOf('data-animation-hide') >= 0 || - this.fluidbook.settings.clinks[page].indexOf('data-animation-hide-on-leave') >= 0; + if (this._needSeparateTextures[page] === undefined) { + var $this = this; + this._needSeparateTextures[page] = false; + $.each(this.fluidbook.settings.clinks[page], function (blendmode, links) { + $.each(links, function (k, link) { + if (link.indexOf('data-animation-hide') >= 0 || link.indexOf('data-animation-hide-on-leave') >= 0) { + $this._needSeparateTextures[page] = true; + return false; + } + }); + if ($this._needSeparateTextures[page]) { + return false; + } + }); + } + return this._needSeparateTextures[page]; }, loadTexture: function (page, callback, enter) { if (enter === undefined) { @@ -482,11 +496,17 @@ FluidbookLoader.prototype = { _preloadContentLinkTextures: function (page, clinks, enter, callback) { var textures = {}; - if (clinks === '') { + + var cl = ''; + $.each(clinks, function (blendmode, links) { + cl += links.join(''); + }); + + if (cl === '') { callback(textures); return; } - $("body").append(''); + $("body").append(''); var loaded = 0; var nb = 0; @@ -521,6 +541,7 @@ FluidbookLoader.prototype = { } var $this = this; var clinks = this.handleExtension(this.fluidbook.settings.clinks[page]); + this._preloadContentLinkTextures(page, clinks, enter, function (textures) { var d = 1024; var c = document.getElementById("pscanvas"); -- 2.39.5