mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Default to element dimension if image size cannot be determined (vector images)
This commit is contained in:
parent
2a020e5a21
commit
44b958beaf
14
dist/html2canvas.js
vendored
14
dist/html2canvas.js
vendored
@ -324,7 +324,7 @@ ImageLoader.prototype.loadImage = function(imageData) {
|
||||
var src = imageData.args[0];
|
||||
if (src.match(/data:image\/.*;base64,/i)) {
|
||||
return new ImageContainer(src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''), false);
|
||||
} else if (/(.+).svg$/i.test(src) && !this.support.svg) {
|
||||
} else if (/(.+).svg$/i.test(src) && !this.support.svg && !this.options.allowTaint) {
|
||||
return new SVGContainer(src);
|
||||
} else if (this.isSameOrigin(src) || this.options.allowTaint === true) {
|
||||
return new ImageContainer(src, false);
|
||||
@ -1587,16 +1587,18 @@ Renderer.prototype.renderImage = function(container, bounds, borderData, imageCo
|
||||
paddingBottom = container.cssInt('paddingBottom'),
|
||||
borders = borderData.borders;
|
||||
|
||||
var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);
|
||||
var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);
|
||||
this.drawImage(
|
||||
imageContainer,
|
||||
0,
|
||||
0,
|
||||
imageContainer.image.width,
|
||||
imageContainer.image.height,
|
||||
imageContainer.image.width || width,
|
||||
imageContainer.image.height || height,
|
||||
bounds.left + paddingLeft + borders[3].width,
|
||||
bounds.top + paddingTop + borders[0].width,
|
||||
bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight),
|
||||
bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom)
|
||||
width,
|
||||
height
|
||||
);
|
||||
};
|
||||
|
||||
@ -1870,7 +1872,7 @@ CanvasRenderer.prototype.taints = function(imageContainer) {
|
||||
};
|
||||
|
||||
CanvasRenderer.prototype.drawImage = function(imageContainer, sx, sy, sw, sh, dx, dy, dw, dh) {
|
||||
if (!this.taints(imageContainer)) {
|
||||
if (!this.taints(imageContainer) || this.options.allowTaint) {
|
||||
this.ctx.drawImage(imageContainer.image, sx, sy, sw, sh, dx, dy, dw, dh);
|
||||
}
|
||||
};
|
||||
|
4
dist/html2canvas.min.js
vendored
4
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
@ -12,16 +12,18 @@ Renderer.prototype.renderImage = function(container, bounds, borderData, imageCo
|
||||
paddingBottom = container.cssInt('paddingBottom'),
|
||||
borders = borderData.borders;
|
||||
|
||||
var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);
|
||||
var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);
|
||||
this.drawImage(
|
||||
imageContainer,
|
||||
0,
|
||||
0,
|
||||
imageContainer.image.width,
|
||||
imageContainer.image.height,
|
||||
imageContainer.image.width || width,
|
||||
imageContainer.image.height || height,
|
||||
bounds.left + paddingLeft + borders[3].width,
|
||||
bounds.top + paddingTop + borders[0].width,
|
||||
bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight),
|
||||
bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom)
|
||||
width,
|
||||
height
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user