html2canvas-pro 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 1.5.2 <undefined>
2
+ * html2canvas-pro 1.5.3 <undefined>
3
3
  * Copyright (c) 2024 yorickshan <https://github.com/yorickshan>
4
4
  * Released under MIT License
5
5
  */
@@ -8093,7 +8093,7 @@
8093
8093
  case 0:
8094
8094
  index = container.styles.backgroundImage.length - 1;
8095
8095
  _loop_1 = function (backgroundImage) {
8096
- var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
8096
+ var image, url, imageWidth, imageHeight, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
8097
8097
  return __generator(this, function (_h) {
8098
8098
  switch (_h.label) {
8099
8099
  case 0:
@@ -8113,10 +8113,12 @@
8113
8113
  return [3 /*break*/, 4];
8114
8114
  case 4:
8115
8115
  if (image) {
8116
+ imageWidth = isNaN(image.width) || image.width === 0 ? 1 : image.width;
8117
+ imageHeight = isNaN(image.height) || image.height === 0 ? 1 : image.height;
8116
8118
  _c = calculateBackgroundRendering(container, index, [
8117
- image.width,
8118
- image.height,
8119
- image.width / image.height
8119
+ imageWidth,
8120
+ imageHeight,
8121
+ imageWidth / imageHeight
8120
8122
  ]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
8121
8123
  pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
8122
8124
  this_1.renderRepeat(path, pattern, x, y);