mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix: Render background-size correctly with no-repeat #447
This commit is contained in:
parent
1d8a316f13
commit
3f3424e49c
2
dist/html2canvas.js
vendored
2
dist/html2canvas.js
vendored
@ -2347,7 +2347,7 @@ Renderer.prototype.renderBackgroundRepeating = function(container, bounds, image
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + borderData[0], imageContainer.image.width, 99999, borderData);
|
||||
break;
|
||||
case "no-repeat":
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], imageContainer.image.width, imageContainer.image.height, borderData);
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], size.width, size.height, borderData);
|
||||
break;
|
||||
default:
|
||||
this.renderBackgroundRepeat(imageContainer, position, size, {top: bounds.top, left: bounds.left}, borderData[3], borderData[0]);
|
||||
|
2
dist/html2canvas.min.js
vendored
2
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
@ -95,7 +95,7 @@ Renderer.prototype.renderBackgroundRepeating = function(container, bounds, image
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + borderData[0], imageContainer.image.width, 99999, borderData);
|
||||
break;
|
||||
case "no-repeat":
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], imageContainer.image.width, imageContainer.image.height, borderData);
|
||||
this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], size.width, size.height, borderData);
|
||||
break;
|
||||
default:
|
||||
this.renderBackgroundRepeat(imageContainer, position, size, {top: bounds.top, left: bounds.left}, borderData[3], borderData[0]);
|
||||
|
@ -19,15 +19,27 @@
|
||||
}
|
||||
|
||||
.horizontal div {
|
||||
width: 400px; height: 200px;
|
||||
width: 400px; height: 100px;
|
||||
}
|
||||
|
||||
.vertical div {
|
||||
width: 200px; height: 400px;
|
||||
width: 200px; height: 200px;
|
||||
}
|
||||
|
||||
.container {
|
||||
float: left;
|
||||
border: 1px solid black;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-image: url(../../assets/image.jpg);
|
||||
background-size: 34px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container"></div>
|
||||
|
||||
<div class="horizontal">
|
||||
<div style='background-size: cover;'></div>
|
||||
|
Loading…
Reference in New Issue
Block a user