]> _ Git - fluidbook-html5.git/commitdiff
wip #4550 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 21 Jun 2021 16:52:29 +0000 (18:52 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 21 Jun 2021 16:52:29 +0000 (18:52 +0200)
js/libs/fluidbook/fluidbook.loader.js

index 690c648dc87f721e128beb1f454f903e3b2bad1d..3792404681394d51038deec62d346a4f08e027dc 100644 (file)
@@ -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('<div class="texture_clinks" data-page="' + page + '">' + clinks + '</div>');
+        $("body").append('<div class="texture_clinks" data-page="' + page + '">' + cl + '</div>');
 
         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");