Skip to content

Commit af61fab

Browse files
author
David Khuu
committed
Adjust the font's size based on the height of the signature pad
rpmsoftware#10
1 parent d73c491 commit af61fab

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

injectedJavaScript/application.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ var content = (penColor, backgroundColor, dataURL, penMinWidth, penMaxWidth, use
6161
canvasElement.width = bodyWidth * devicePixelRatio;
6262
canvasElement.height = bodyHeight * devicePixelRatio;
6363
64-
var oldWidth = canvasElement.offsetWidth;
65-
var oldHeight = canvasElement.offsetHeight;
6664
var w = bodyWidth;
6765
var h = bodyHeight;
68-
canvasElement.width = oldWidth * 2;
69-
canvasElement.height = oldHeight * 2;
66+
canvasElement.width = canvasElement.offsetWidth * 2;
67+
canvasElement.height = canvasElement.offsetHeight * 2;
7068
71-
var fontSize = 70;
69+
var fontToHeightRatio = 45 / 159;
70+
var fontSize = canvasElement.height * fontToHeightRatio;
7271
var textHeight = 18;
7372
var textWidth = -1;
7473
do {

0 commit comments

Comments
 (0)