Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #48 from kfprimm/high-dpi
Browse files Browse the repository at this point in the history
Factor DPI into setDataUrl
  • Loading branch information
jasny authored Feb 16, 2017
2 parents 366814f + 3eaa890 commit f4e4e18
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ angular.module('signature').directive('signaturePad', ['$interval', '$timeout',
scope.signaturePad = new SignaturePad(canvas);

scope.setDataUrl = function(dataUrl) {
var ratio = Math.max(window.devicePixelRatio || 1, 1);

ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.scale(1, 1);
ctx.scale(ratio, ratio);

scope.signaturePad.clear();
scope.signaturePad.fromDataURL(dataUrl);
Expand Down Expand Up @@ -151,4 +153,3 @@ angular.module('signature').directive('signaturePad', ['$interval', '$timeout',

// Backward compatibility
angular.module('ngSignaturePad', ['signature']);

0 comments on commit f4e4e18

Please sign in to comment.