]> _ Git - fluidbook-html5.git/commitdiff
done #1532 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jul 2017 16:32:53 +0000 (18:32 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jul 2017 16:32:53 +0000 (18:32 +0200)
js/libs/fluidbook/fluidbook.loader.js

index 2fb86c903d41a086c2dec3bf4285392904ff50f8..a9c5d55a4d88d0eb357f0c3fe1029cd858b52d18 100644 (file)
@@ -9,6 +9,15 @@ function FluidbookLoader(fluidbook) {
 }
 
 FluidbookLoader.prototype = {
+    getVersionToLoad: function (page) {
+        if (this.fluidbook.vectorTexts) {
+            if (this.fluidbook.datas.rasterizePages.indexOf(page) == -1) {
+                return 'textasvector';
+            }
+        }
+        return 'raster';
+    },
+
     canPreload: function () {
         this.numPreload = 6;
         if (this.fluidbook.support.imagesVersion) {
@@ -33,7 +42,7 @@ FluidbookLoader.prototype = {
             return;
         }
         this._loadBackground($page, function () {
-            if ($this.fluidbook.vectorsVersion) {
+            if ($this.getVersionToLoad($page) == 'textasvector') {
                 $this._loadTexts($page, function () {
                     $this.preloadPagesBeforeTransition($pages, $callback);
                 });
@@ -56,7 +65,7 @@ FluidbookLoader.prototype = {
         }
 
         this.backgrounds[preloadingPage] = this.loadImage(this.getBackgroundURL(preloadingPage), null, null, null, function () {
-            if ($this.fluidbook.vectorTexts) {
+            if ($this.getVersionToLoad(preloadingPage) == 'textasvector') {
                 $this._loadTexts(preloadingPage, function () {
                     $this.preloadPages();
                 });
@@ -186,11 +195,7 @@ FluidbookLoader.prototype = {
         }
     },
     getBackgroundURL: function (page) {
-        var prefix = 'p';
-        if (this.fluidbook.support.imagesVersion) {
-            prefix = 't';
-        }
-
+        var prefix = this.getVersionToLoad(page) == 'textasvector' ? 'p' : 't';
         return 'data/background/' + this.fluidbook.support.resolution + '/' + prefix + page + '.jpg';
     },
     getTextsURL: function (page) {
@@ -224,7 +229,7 @@ FluidbookLoader.prototype = {
     },
     loadTexts: function (pageNr, callback) {
 
-        if (this.fluidbook.support.imagesVersion) {
+        if (this.getVersionToLoad(pageNr) == 'raster') {
             callback();
             return;
         }
@@ -242,6 +247,7 @@ FluidbookLoader.prototype = {
         }
     },
     _loadTexts: function (pageNr, callback) {
+        console.log('load texts ' + pageNr);
         var w = this.fluidbook.datas.width / 0.75;
         var h = this.fluidbook.datas.height / 0.75;
         this.texts[pageNr] = this.loadImage(this.getTextsURL(pageNr), w, h, 'image/svg+xml', callback);