mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix individual border rendering (Fix #1349)
This commit is contained in:
parent
b844e28116
commit
ca2200d270
@ -165,7 +165,7 @@ export default class Renderer {
|
|||||||
!container.style.background.backgroundColor.isTransparent() ||
|
!container.style.background.backgroundColor.isTransparent() ||
|
||||||
container.style.background.backgroundImage.length;
|
container.style.background.backgroundImage.length;
|
||||||
|
|
||||||
const renderableBorders = container.style.border.filter(
|
const hasRenderableBorders = container.style.border.some(
|
||||||
border =>
|
border =>
|
||||||
border.borderStyle !== BORDER_STYLE.NONE && !border.borderColor.isTransparent()
|
border.borderStyle !== BORDER_STYLE.NONE && !border.borderColor.isTransparent()
|
||||||
);
|
);
|
||||||
@ -186,12 +186,17 @@ export default class Renderer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
renderableBorders.forEach((border, side) => {
|
container.style.border.forEach((border, side) => {
|
||||||
this.renderBorder(border, side, container.curvedBounds);
|
if (
|
||||||
|
border.borderStyle !== BORDER_STYLE.NONE &&
|
||||||
|
!border.borderColor.isTransparent()
|
||||||
|
) {
|
||||||
|
this.renderBorder(border, side, container.curvedBounds);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (HAS_BACKGROUND || renderableBorders.length) {
|
if (HAS_BACKGROUND || hasRenderableBorders) {
|
||||||
const paths = container.parent ? container.parent.getClipPaths() : [];
|
const paths = container.parent ? container.parent.getClipPaths() : [];
|
||||||
if (paths.length) {
|
if (paths.length) {
|
||||||
this.target.clip(paths, callback);
|
this.target.clip(paths, callback);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
background:#6F428C;
|
background:#6F428C;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box1 {
|
.box1 {
|
||||||
@ -33,6 +34,12 @@
|
|||||||
border-color: green;
|
border-color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.box5 {
|
||||||
|
border-style: none;
|
||||||
|
border-bottom: 50px solid #807d32;
|
||||||
|
border-bottom-width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
background: #3a84c3;
|
background: #3a84c3;
|
||||||
}
|
}
|
||||||
@ -43,5 +50,6 @@
|
|||||||
<div class="box2"> </div>
|
<div class="box2"> </div>
|
||||||
<div class="box3"> </div>
|
<div class="box3"> </div>
|
||||||
<div class="box4"> </div>
|
<div class="box4"> </div>
|
||||||
|
<div class="box5"> </div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user