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

Commit

Permalink
Factor DPI into setDataUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
kfprimm authored Feb 15, 2017
1 parent 366814f commit 3eaa890
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 3eaa890

Please sign in to comment.