diff --git a/node_modules/html2canvas/dist/html2canvas.js b/node_modules/html2canvas/dist/html2canvas.js
index 84cb30d..d914e1b 100644
--- a/node_modules/html2canvas/dist/html2canvas.js
+++ b/node_modules/html2canvas/dist/html2canvas.js
@@ -6803,14 +6803,40 @@
});
};
CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
+ // if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
+ // var box = contentBox(container);
+ // var path = calculatePaddingBoxPath(curves);
+ // this.path(path);
+ // this.ctx.save();
+ // this.ctx.clip();
+ // this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
+ // this.ctx.restore();
+ // }
if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
- var box = contentBox(container);
- var path = calculatePaddingBoxPath(curves);
- this.path(path);
- this.ctx.save();
- this.ctx.clip();
- this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
- this.ctx.restore();
+ var box = contentBox(container);
+ var path = calculatePaddingBoxPath(curves);
+
+ this.path(path);
+ this.ctx.save();
+ this.ctx.clip();
+
+ let newWidth;
+ let newHeight;
+ let newX = box.left;
+ let newY = box.top;
+
+ if(container.intrinsicWidth / box.width < container.intrinsicHeight / box.height) {
+ newWidth = box.width;
+ newHeight = container.intrinsicHeight * (box.width / container.intrinsicWidth);
+ newY = box.top + (box.height - newHeight) / 2;
+ } else {
+ newWidth = container.intrinsicWidth * (box.height / container.intrinsicHeight);
+ newHeight = box.height;
+ newX = box.left + (box.width - newWidth) / 2;
+ }
+
+ this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, newX, newY, newWidth, newHeight);
+ this.ctx.restore();
}
};
CanvasRenderer.prototype.renderNodeContent = function (paint) {