legalthings / angular-signature

HTML5 canvas based smooth signature drawing as angularJS directive (http://szimek.github.io/signature_pad/)
MIT License
105 stars 91 forks source link

Canvas not resizing properly #33

Closed johhansantana closed 7 years ago

johhansantana commented 7 years ago

I'm having an issue with the canvas size

screen shot 2016-10-03 at 11 58 27 am
<signature-pad dataurl="" accept="accept" clear="clear" ng-model="invoice.signature"
               style="width: 300px; height: 150px; border: 1px solid black;"></signature-pad>
<button ng-click="clear()">Clear signature</button>
<button ng-click="invoice.signature = accept(); checkSign(invoice.signature)">Sign</button>

This is only happening in a macbook environment. When I try the app in a windows or linux it works as expected.

johhansantana commented 7 years ago

well, somehow fixed it a bit by putting the width and height tags inlined

<signature-pad width="200px" height="100px" dataurl="" accept="accept" clear="clear" ng-model="invoice.signature"
               style="border: 1px solid black;"></signature-pad>
<button ng-click="clear()">Clear signature</button>
<button ng-click="invoice.signature = accept(); checkSign(invoice.signature)">Sign</button>

but now it doesn't read the sizes, it stays at 600px width:

screen shot 2016-10-03 at 12 42 19 pm

edit Workaround for the moment:

$timeout(function () {
  $('.signature canvas').css('width', '300px').css('height', '100');
});