@@ -1659,6 +1659,8 @@ function cloneNode(node, javascriptEnabled) {
1659
1659
var child = node.firstChild;
1660
1660
while(child) {
1661
1661
if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
1662
+ console.log(clone);
1663
+
1662
1664
clone.appendChild(cloneNode(child, javascriptEnabled));
1663
1665
}
1664
1666
child = child.nextSibling;
@@ -1700,6 +1702,7 @@ module.exports = function(ownerDocument, containerDocument, width, height, optio
1700
1702
container.style.left = "-10000px";
1701
1703
container.style.top = "0px";
1702
1704
container.style.border = "0";
1705
+ container.style.border = "0";
1703
1706
container.width = width;
1704
1707
container.height = height;
1705
1708
container.scrolling = "no"; // ios won't scroll without it
@@ -2078,6 +2081,7 @@ module.exports = (typeof(document) === "undefined" || typeof(Object.create) !==
2078
2081
function renderDocument(document, options, windowWidth, windowHeight, html2canvasIndex) {
2079
2082
return createWindowClone(document, document, windowWidth, windowHeight, options, document.defaultView.pageXOffset, document.defaultView.pageYOffset).then(function(container) {
2080
2083
log("Document cloned");
2084
+
2081
2085
var attributeName = html2canvasNodeAttribute + html2canvasIndex;
2082
2086
var selector = "[" + attributeName + "='" + html2canvasIndex + "']";
2083
2087
document.querySelector(selector).removeAttribute(attributeName);
@@ -3516,7 +3520,17 @@ function calculateCurvePoints(bounds, borderRadius, borders) {
3516
3520
blh = borderRadius[3][0],
3517
3521
blv = borderRadius[3][1];
3518
3522
3519
- var topWidth = width - trh,
3523
+ var halfHeight = Math.floor(height / 2);
3524
+ tlh = tlh > halfHeight ? halfHeight : tlh;
3525
+ tlv = tlv > halfHeight ? halfHeight : tlv;
3526
+ trh = trh > halfHeight ? halfHeight : trh;
3527
+ trv = trv > halfHeight ? halfHeight : trv;
3528
+ brh = brh > halfHeight ? halfHeight : brh;
3529
+ brv = brv > halfHeight ? halfHeight : brv;
3530
+ blh = blh > halfHeight ? halfHeight : blh;
3531
+ blv = blv > halfHeight ? halfHeight : blv;
3532
+
3533
+ var topWidth = width - trh,
3520
3534
rightHeight = height - brv,
3521
3535
bottomWidth = width - brh,
3522
3536
leftHeight = height - blv;
@@ -4185,8 +4199,8 @@ CanvasRenderer.prototype.drawImage = function(imageContainer, sx, sy, sw, sh, dx
4185
4199
CanvasRenderer.prototype.clip = function(shapes, callback, context) {
4186
4200
this.ctx.save();
4187
4201
shapes.filter(hasEntries).forEach(function(shape) {
4188
- // shape = this.applyRatioToShape(shape);
4189
- // this.shape(shape).clip();
4202
+ shape = this.applyRatioToShape(shape);
4203
+ this.shape(shape).clip();
4190
4204
}, this);
4191
4205
callback.call(context);
4192
4206
this.ctx.restore();
@@ -8755,6 +8769,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
8755
8769
//Update pixelRatio since could be resized on different screen with different ratio
8756
8770
HTMLGL.pixelRatio = window.devicePixelRatio || 1;
8757
8771
8772
+ console.log(HTMLGL.pixelRatio);
8773
+
8758
8774
width = width * HTMLGL.pixelRatio;
8759
8775
height = height * HTMLGL.pixelRatio;
8760
8776
@@ -8980,7 +8996,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
8980
8996
}
8981
8997
}
8982
8998
8983
- var isInsideHtml2Canvas = !isMounted && (this.baseURI !== undefined && this.baseURI.length === 0);
8999
+ debugger;
9000
+ var isInsideHtml2Canvas = !isMounted || (this.baseURI === undefined || this.baseURI === '' || this.baseURI === null);
8984
9001
8985
9002
if (!isInsideHtml2Canvas) {
8986
9003
HTMLGL.elements.push(this);
@@ -9072,16 +9089,18 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
9072
9089
9073
9090
return new Promise(function(resolve, reject){
9074
9091
self.image = html2canvas(self, {
9075
- onrendered: self.applyNewTexture,
9076
9092
width: self.boundingRect.width * HTMLGL.pixelRatio,
9077
9093
height: self.boundingRect.height * HTMLGL.pixelRatio
9078
- }).then(resolve);
9094
+ }).then(function(textureCanvas){
9095
+ self.applyNewTexture(textureCanvas);
9096
+ resolve();
9097
+ });
9079
9098
});
9080
9099
}
9081
9100
9082
9101
//Recreating texture from canvas given after calling updateTexture
9083
9102
p.applyNewTexture = function (textureCanvas) {
9084
- // document.body.appendChild(textureCanvas);
9103
+ document.body.appendChild(textureCanvas);
9085
9104
this.image = textureCanvas;
9086
9105
this.texture = PIXI.Texture.fromCanvas(this.image);
9087
9106
0 commit comments