Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions canvas2svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@
* @private
*/
ctx.prototype.__applyStyleState = function (styleState) {
if(!styleState)
return;
var keys = Object.keys(styleState), i, key;
for (i=0; i<keys.length; i++) {
key = keys[i];
Expand Down Expand Up @@ -350,7 +352,7 @@
ctx.prototype.__applyStyleToCurrentElement = function (type) {
var currentElement = this.__currentElement;
var currentStyleGroup = this.__currentElementsToStyle;
if (currentStyleGroup) {
if (false && currentStyleGroup) {
currentElement.setAttribute(type, "");
currentElement = currentStyleGroup.element;
currentStyleGroup.children.forEach(function (node) {
Expand Down Expand Up @@ -1141,9 +1143,12 @@
svgImage = this.__createElement("image");
svgImage.setAttribute("width", dw);
svgImage.setAttribute("height", dh);
svgImage.setAttribute("opacity", this.globalAlpha);
svgImage.setAttribute("preserveAspectRatio", "none");

if (sx || sy || sw !== image.width || sh !== image.height) {
// force embed every images's base64 in SVG by using 'true'
// makes SVG self-contained
if (true || sx || sy || sw !== image.width || sh !== image.height) {
//crop the image using a temporary canvas
canvas = this.__document.createElement("canvas");
canvas.width = dw;
Expand Down