]> _ Git - fluidbook-html5.git/commitdiff
wait #7125 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 9 Oct 2024 14:42:34 +0000 (16:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 9 Oct 2024 14:42:34 +0000 (16:42 +0200)
js/libs/fluidbook/fluidbook.loader.js

index 631035db1efc0659263a7f7b00f8bb1c486fb5fb..3d26a7c5e97d12b0fcfad5b8d089733a4e8fe7bd 100644 (file)
@@ -697,19 +697,6 @@ 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;
@@ -754,6 +741,19 @@ FluidbookLoader.prototype = {
                             let width = w * wr;
                             let height = h * hr;
 
+                            if ($(this).is('[data-polygon]')) {
+                                let p = $(this).data('polygon');
+                                let clip = new Path2D();
+                                clip.moveTo(left + (p[0].x * cwr), top + (p[0].y * chr));
+                                for (let i = 1; i < p.length; i++) {
+                                    clip.lineTo(left + (p[i].x * cwr), top + (p[i].y * chr));
+                                }
+                                clip.lineTo(left + (p[0].x * cwr), top + (p[0].y * chr));
+                                ctx.save();
+                                ctx.clip(clip);
+                            }
+
+
                             let blendmode = $(this).data('blendmode');
 
                             if (blendmode === 'normal') {
@@ -865,8 +865,8 @@ 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;
+                let cwr = wr * $this.fluidbook.settings.cssScale;
+                let chr = hr * $this.fluidbook.settings.cssScale;
 
                 // Draw background
                 ctx.fillStyle = "#FFFFFF";