mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Merge 6879fdc8fc
into 6020386bbe
This commit is contained in:
commit
1966b2ebc8
@ -600,11 +600,20 @@ export class CanvasRenderer extends Renderer {
|
||||
image.height,
|
||||
image.width / image.height
|
||||
]);
|
||||
const pattern = this.ctx.createPattern(
|
||||
this.resizeImage(image, width, height),
|
||||
'repeat'
|
||||
) as CanvasPattern;
|
||||
this.renderRepeat(path, pattern, x, y);
|
||||
const scaleX = width / image.naturalWidth;
|
||||
const scaleY = height / image.naturalHeight;
|
||||
const pattern = this.ctx.createPattern(image, 'repeat') as CanvasPattern;
|
||||
const scaledPath = (path as Vector[]).map((item) => {
|
||||
item.x = item.x / scaleX;
|
||||
item.y = item.y / scaleY;
|
||||
return item;
|
||||
});
|
||||
const scaledOffsetX = x / scaleX;
|
||||
const scaledOffsetY = y / scaleY;
|
||||
this.ctx.save();
|
||||
this.ctx.scale(scaleX, scaleY);
|
||||
this.renderRepeat(scaledPath, pattern, scaledOffsetX, scaledOffsetY);
|
||||
this.ctx.restore();
|
||||
}
|
||||
} else if (isLinearGradient(backgroundImage)) {
|
||||
const [path, x, y, width, height] = calculateBackgroundRendering(container, index, [null, null, null]);
|
||||
|
Loading…
Reference in New Issue
Block a user