Skip to content

Commit

Permalink
Svg bug fixed.
Browse files Browse the repository at this point in the history
Svg bug fixed.
  • Loading branch information
ushelp committed Aug 13, 2021
1 parent 4ab2d88 commit e6ae474
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions canvas2svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1225,14 +1225,13 @@
svgImage.setAttribute("height", dh);
svgImage.setAttribute("preserveAspectRatio", "none");
svgImage.setAttribute("opacity", this.globalAlpha);

if (sx || sy || sw !== image.width || sh !== image.height) {
//crop the image using a temporary canvas
canvas = this.__document.createElement("canvas");
canvas.width = dw;
canvas.height = dh;
context = canvas.getContext("2d");
context.drawImage(t, sx, sy, sw, sh, 0, 0, dw, dh);
context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);
image = canvas;
}

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* NodeJS QRCode generator. Can save image or svg to file, get standard base64 image data url text or get SVG serialized text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.(Running without DOM on server side)
*
* Version 4.3.4
* Version 4.3.5
*
* @author [ [email protected] ]
*
Expand Down
2 changes: 1 addition & 1 deletion index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "easyqrcodejs-nodejs",
"version": "4.3.4",
"version": "4.3.5",
"description": "NodeJS QRCode generator. Can save image or svg to file, get standard base64 image data url text or get SVG serialized text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.(Running without DOM on server side)",
"main": "index.min.js",
"scripts": {},
Expand Down

0 comments on commit e6ae474

Please sign in to comment.