I am trying to use signaturepad in a bootstrap modal, I have a canvas in a div:
<div class="modal-body">
<div class='signature-container' >
<canvas id="signature"></canvas>
</canvas>
</div>
On init, I do (coffeescript):
canvas = $("canvas#signature")[0]
signature_pad = new SignaturePad(canvas, backgroundColor: 'rgb(255, 255, 255)')
My css for the canvas is (because I want the canvas to fill the div)
width:100%; height:100%;
Everything works, but the "ink" is offset from the mouse pointer. When I first click, the initial ink appears to the right and below of the mouse pointer. The farther down I move the mouse, the farther the vertical offset, same with horizontal (i.e. the offset appears to scale linearly). I tried implementing the resize function in the demo but chrome evaluates offsetWidth to 0 and the canvas just shrinks to 0x0.
Anyone have any ideas what I'm doing wrong?