From: Vincent Vanwaelscappel Date: Wed, 18 Sep 2024 17:07:04 +0000 (+0200) Subject: wait #7087 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=99de0f34c9329cf2d5a73073143cd0b19883a639;p=fluidbook-html5.git wait #7087 @2 --- diff --git a/js/libs/fluidbook/fluidbook.loader.js b/js/libs/fluidbook/fluidbook.loader.js index 4f494b92..e375c295 100644 --- a/js/libs/fluidbook/fluidbook.loader.js +++ b/js/libs/fluidbook/fluidbook.loader.js @@ -685,7 +685,6 @@ 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) { - let afterTexts = function () { // Draw content links if (clinks !== '') { @@ -698,6 +697,19 @@ FluidbookLoader.prototype = { } + if ($(this).is('[data-polygon]')) { + let p = $(this).data('polygon'); + let clip = new Path2D(); + clip.moveTo(p[0].x * cwr, p[0].y * chr); + for (let i = 1; i < p.length; i++) { + clip.lineTo(p[i].x * cwr, p[i].y * chr); + } + clip.lineTo(p[0].x * cwr, p[0].y * chr); + ctx.save(); + ctx.clip(clip); + } + + let texture; let scale = 1; @@ -769,6 +781,9 @@ FluidbookLoader.prototype = { console.warn(texture); } } + if ($(this).is('[data-polygon]')) { + ctx.restore(); + } }); $('.texture_clinks[data-page="' + page + '"]').remove(); } @@ -850,6 +865,9 @@ FluidbookLoader.prototype = { let wr = dw / $this.fluidbook.settings.width; let hr = dh / $this.fluidbook.settings.height; + let cwr = wr * this.fluidbook.settings.cssScale; + let chr = hr * this.fluidbook.settings.cssScale; + // Draw background ctx.fillStyle = "#FFFFFF"; ctx.fillRect(0, 0, dw, dh);