]> _ Git - fluidbook-html5.git/commitdiff
wait #6815 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Mar 2024 18:00:15 +0000 (19:00 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Mar 2024 18:00:15 +0000 (19:00 +0100)
_index.html
js/libs/fluidbook/fluidbook.loader.js
style/fluidbook.less

index 847eb455b1e7ab7328199038033e97d688878efc..24e0319fdd9b0811c80569b2f1e1ce3fb294a025 100644 (file)
 <div id="pagesContents" aria-hidden="true"><!-- $pagesContents --></div>
 <div id="op" aria-hidden="true"></div>
 <div id="ol" aria-hidden="true"></div>
-<canvas id="pscanvas" width="4096" height="4096" aria-hidden="true"></canvas>
 <div id="loader" aria-hidden="true"></div>
 <div id="hiddencontents" aria-hidden="true"></div>
 <div id="splash" style="background-color:#<!-- $bgcolor -->;<!-- $splashstyles -->" aria-hidden="true">
index 184eb58b52c8a2e7b696291e02b9d41d508fe041..472500fdb8ffdd3226b45fd33638fbfa8d504154 100644 (file)
@@ -685,16 +685,15 @@ FluidbookLoader.prototype = {
 
         this._preloadContentLinkTextures(page, this.fluidbook.settings.clinks[page], this.fluidbook.settings.links[page], enter, function (textures, clinks) {
             if ($this.fluidbook.pagetransitions.flip3d !== false) {
-                var dh = screen.height * window.devicePixelRatio * 1.1;
-                var dw = $this.fluidbook.settings.width * (dh / $this.fluidbook.settings.height);
-                var c = document.getElementById("pscanvas");
-                c.width = dw;
-                c.height = dh;
-                var ctx = c.getContext("2d");
-                ctx.clearRect(0, 0, dw, dh);
+                let dh = screen.height * window.devicePixelRatio * 1.1;
+                let dw = $this.fluidbook.settings.width * (dh / $this.fluidbook.settings.height);
+                let canvas = $('<canvas class="pscanvas" id="pscanvas_' + page + '" width="' + dw + '" height="' + dh + '" aria-hidden="true"></canvas>');
+                $("body").append(canvas);
+                let c=canvas.get(0);
+                let ctx = c.getContext("2d");
 
-                var wr = dw / $this.fluidbook.settings.width;
-                var hr = dh / $this.fluidbook.settings.height;
+                let wr = dw / $this.fluidbook.settings.width;
+                let hr = dh / $this.fluidbook.settings.height;
 
                 // Draw background
                 if ($this.backgrounds[page] !== undefined && $this.backgrounds[page] !== null) {
@@ -704,7 +703,7 @@ FluidbookLoader.prototype = {
                     ctx.fillRect(0, 0, dw, dh);
                 }
 
-                var afterTexts = function () {
+                let afterTexts = function () {
                     // Draw content links
                     if (clinks !== '') {
                         $('.texture_clinks[data-page="' + page + '"] .contentLink').each(function () {
@@ -727,7 +726,7 @@ FluidbookLoader.prototype = {
                             let th;
 
                             if ($(this).is('[data-image]')) {
-                                var i = $(this).data('id');
+                                let i = $(this).data('id');
                                 if (textures[i] === undefined || textures[i] === null) {
                                     return;
                                 }
@@ -755,12 +754,12 @@ FluidbookLoader.prototype = {
                                 sh = th - (sy / (1 - origin[1]));
                             }
 
-                            var left = (parseFloat($(this).css('left'))) * wr;
-                            var top = (parseFloat($(this).css('top'))) * hr;
-                            var width = w * wr;
-                            var height = h * hr;
+                            let left = (parseFloat($(this).css('left'))) * wr;
+                            let top = (parseFloat($(this).css('top'))) * hr;
+                            let width = w * wr;
+                            let height = h * hr;
 
-                            var blendmode = $(this).data('blendmode');
+                            let blendmode = $(this).data('blendmode');
 
                             if (blendmode === 'normal') {
                                 ctx.globalCompositeOperation = 'source-over';
@@ -793,8 +792,8 @@ FluidbookLoader.prototype = {
 
                     // Draw the shadow if necessary
                     if ($this.fluidbook.settings.shadeAlpha > 0) {
-                        var sw = dw * .25;
-                        var s, x;
+                        let sw = dw * .25;
+                        let s, x;
                         if (page % 2 === 0 && $this.fluidbook.l10n.ltr || page % 2 === 1 && $this.fluidbook.l10n.rtl) {
                             // Left
                             s = $this.shadeLeft;
@@ -811,7 +810,7 @@ FluidbookLoader.prototype = {
 
                     try {
                         let dataurl = c.toDataURL("image/png");
-                        var i = new Image();
+                        let i = new Image();
                         i.onload = function () {
                             if (enter) {
                                 $this.textures[page] = i;
@@ -821,6 +820,7 @@ FluidbookLoader.prototype = {
                             callback();
                         }
                         i.src = dataurl;
+                        $(canvas).remove();
                     } catch (e) {
                         console.warn(e);
                         callback();
@@ -835,7 +835,7 @@ FluidbookLoader.prototype = {
                         });
                     } else {
                         try {
-                            var img = $this.texts[page];
+                            let img = $this.texts[page];
                             if (img !== undefined && img !== null) {
                                 img = img.get(0);
                                 if (img.width === 0) {
index fc71df63f089dbcbf6ee6e3fdf7c0708d1153670..d4c3e51a9731b0f97f66a11082e03254be9b7dc2 100644 (file)
@@ -2980,7 +2980,7 @@ body > input {
 
 @import "additional.less";
 
-#pscanvas {
+.pscanvas {
   visibility: hidden;
 }