Merge pull request #1 from FuZhenn/Fuzhenn-fix-draw-empty-ctx
when drawImage a empty C2S context
This commit is contained in:
commit
73735519b1
@ -1038,17 +1038,21 @@
|
|||||||
//canvas2svg mock canvas context. In the future we may want to clone nodes instead.
|
//canvas2svg mock canvas context. In the future we may want to clone nodes instead.
|
||||||
//also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.
|
//also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.
|
||||||
svg = image.getSvg();
|
svg = image.getSvg();
|
||||||
defs = svg.childNodes[0];
|
if (svg.childNodes && svg.childNodes.length > 1) {
|
||||||
while(defs.childNodes.length) {
|
defs = svg.childNodes[0];
|
||||||
id = defs.childNodes[0].getAttribute("id");
|
while(defs.childNodes.length) {
|
||||||
this.__ids[id] = id;
|
id = defs.childNodes[0].getAttribute("id");
|
||||||
this.__defs.appendChild(defs.childNodes[0]);
|
this.__ids[id] = id;
|
||||||
|
this.__defs.appendChild(defs.childNodes[0]);
|
||||||
|
}
|
||||||
|
group = svg.childNodes[1];
|
||||||
|
if (group) {
|
||||||
|
parent.appendChild(group);
|
||||||
|
this.__currentElement = group;
|
||||||
|
this.translate(dx, dy);
|
||||||
|
this.__currentElement = currentElement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
group = svg.childNodes[1];
|
|
||||||
parent.appendChild(group);
|
|
||||||
this.__currentElement = group;
|
|
||||||
this.translate(dx, dy);
|
|
||||||
this.__currentElement = currentElement;
|
|
||||||
} else if(image.nodeName === "CANVAS" || image.nodeName === "IMG") {
|
} else if(image.nodeName === "CANVAS" || image.nodeName === "IMG") {
|
||||||
//canvas or image
|
//canvas or image
|
||||||
svgImage = this.__createElement("image");
|
svgImage = this.__createElement("image");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user