}
- 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;
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') {
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";