@@ -1659,6 +1659,8 @@ function cloneNode(node, javascriptEnabled) {
16591659 var child = node.firstChild;
16601660 while(child) {
16611661 if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
1662+ console.log(clone);
1663+
16621664 clone.appendChild(cloneNode(child, javascriptEnabled));
16631665 }
16641666 child = child.nextSibling;
@@ -1700,6 +1702,7 @@ module.exports = function(ownerDocument, containerDocument, width, height, optio
17001702 container.style.left = "-10000px";
17011703 container.style.top = "0px";
17021704 container.style.border = "0";
1705+ container.style.border = "0";
17031706 container.width = width;
17041707 container.height = height;
17051708 container.scrolling = "no"; // ios won't scroll without it
@@ -2078,6 +2081,7 @@ module.exports = (typeof(document) === "undefined" || typeof(Object.create) !==
20782081function renderDocument(document, options, windowWidth, windowHeight, html2canvasIndex) {
20792082 return createWindowClone(document, document, windowWidth, windowHeight, options, document.defaultView.pageXOffset, document.defaultView.pageYOffset).then(function(container) {
20802083 log("Document cloned");
2084+
20812085 var attributeName = html2canvasNodeAttribute + html2canvasIndex;
20822086 var selector = "[" + attributeName + "='" + html2canvasIndex + "']";
20832087 document.querySelector(selector).removeAttribute(attributeName);
@@ -3516,7 +3520,17 @@ function calculateCurvePoints(bounds, borderRadius, borders) {
35163520 blh = borderRadius[3][0],
35173521 blv = borderRadius[3][1];
35183522
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,
35203534 rightHeight = height - brv,
35213535 bottomWidth = width - brh,
35223536 leftHeight = height - blv;
@@ -4185,8 +4199,8 @@ CanvasRenderer.prototype.drawImage = function(imageContainer, sx, sy, sw, sh, dx
41854199CanvasRenderer.prototype.clip = function(shapes, callback, context) {
41864200 this.ctx.save();
41874201 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();
41904204 }, this);
41914205 callback.call(context);
41924206 this.ctx.restore();
@@ -8755,6 +8769,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
87558769 //Update pixelRatio since could be resized on different screen with different ratio
87568770 HTMLGL.pixelRatio = window.devicePixelRatio || 1;
87578771
8772+ console.log(HTMLGL.pixelRatio);
8773+
87588774 width = width * HTMLGL.pixelRatio;
87598775 height = height * HTMLGL.pixelRatio;
87608776
@@ -8980,7 +8996,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
89808996 }
89818997 }
89828998
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);
89849001
89859002 if (!isInsideHtml2Canvas) {
89869003 HTMLGL.elements.push(this);
@@ -9072,16 +9089,18 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
90729089
90739090 return new Promise(function(resolve, reject){
90749091 self.image = html2canvas(self, {
9075- onrendered: self.applyNewTexture,
90769092 width: self.boundingRect.width * HTMLGL.pixelRatio,
90779093 height: self.boundingRect.height * HTMLGL.pixelRatio
9078- }).then(resolve);
9094+ }).then(function(textureCanvas){
9095+ self.applyNewTexture(textureCanvas);
9096+ resolve();
9097+ });
90799098 });
90809099 }
90819100
90829101 //Recreating texture from canvas given after calling updateTexture
90839102 p.applyNewTexture = function (textureCanvas) {
9084- // document.body.appendChild(textureCanvas);
9103+ document.body.appendChild(textureCanvas);
90859104 this.image = textureCanvas;
90869105 this.texture = PIXI.Texture.fromCanvas(this.image);
90879106
0 commit comments