mirror of
https://github.com/aaronleetw/Attendance.git
synced 2024-11-14 19:11:39 -08:00
Update signature pad so it wont clear when height is adjusted; just width
This commit is contained in:
parent
bec7ff7e85
commit
f566884b44
4 changed files with 17 additions and 4 deletions
1
Procfile
1
Procfile
|
@ -1 +0,0 @@
|
|||
web: gunicorn app:app
|
|
@ -5,7 +5,7 @@ Flask == 2.0.1
|
|||
|
||||
# Attendance/app.py: 3
|
||||
# Attendance/test.py: 1
|
||||
Pyrebase == 3.0.27
|
||||
Pyrebase4 == 4.5.0
|
||||
|
||||
# Attendance/app.py: 8
|
||||
pandas == 1.1.3
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
<script type="text/javascript" src="/static/jquery.min.js"></script>
|
||||
<script>
|
||||
var signaturePad, selPeriod;
|
||||
var width = $(window).width();
|
||||
function submitForm() {
|
||||
if (!signaturePad.isEmpty()) {
|
||||
loadingAnimation();
|
||||
|
@ -164,6 +165,7 @@
|
|||
|
||||
var canvas = document.getElementById("signature_pad^" + period);
|
||||
signaturePad = new SignaturePad(canvas);
|
||||
width = $(window).width();
|
||||
function resizeCanvas() {
|
||||
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
||||
canvas.width = canvas.offsetWidth * ratio;
|
||||
|
@ -171,7 +173,12 @@
|
|||
canvas.getContext("2d").scale(ratio, ratio);
|
||||
signaturePad.clear(); // otherwise isEmpty() might return incorrect value
|
||||
}
|
||||
window.addEventListener("resize", resizeCanvas);
|
||||
window.addEventListener("resize", () => {
|
||||
if (width != $(window).width()) {
|
||||
resizeCanvas();
|
||||
width = $(window).width();
|
||||
}
|
||||
});
|
||||
resizeCanvas();
|
||||
}
|
||||
function unCheckAbs(string) {
|
||||
|
|
|
@ -228,6 +228,7 @@
|
|||
</footer>
|
||||
<script>
|
||||
var signaturePad, hrCfrm = false;
|
||||
var width = $(window).width();
|
||||
var periodData = {}
|
||||
{% for i in periods %}
|
||||
periodData['{{i}}'] = '{{ absData[currDate][i]['name'] }}'
|
||||
|
@ -264,6 +265,7 @@
|
|||
$('#finalCheck').removeAttr('hidden');
|
||||
var canvas = document.getElementById("signature_pad");
|
||||
signaturePad = new SignaturePad(canvas);
|
||||
width = $(window).width();
|
||||
function resizeCanvas() {
|
||||
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
||||
canvas.width = canvas.offsetWidth * ratio;
|
||||
|
@ -271,7 +273,12 @@
|
|||
canvas.getContext("2d").scale(ratio, ratio);
|
||||
signaturePad.clear(); // otherwise isEmpty() might return incorrect value
|
||||
}
|
||||
window.addEventListener("resize", resizeCanvas);
|
||||
window.addEventListener("resize", () => {
|
||||
if (width != $(window).width()) {
|
||||
resizeCanvas();
|
||||
width = $(window).width();
|
||||
}
|
||||
});
|
||||
resizeCanvas();
|
||||
}
|
||||
function afterSelAbs(period) {
|
||||
|
|
Loading…
Reference in a new issue