mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge pull request #15870 from marcusmoore/bug/sc-26857
Some checks failed
Crowdin Action / upload-sources-to-crowdin (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Some checks failed
Crowdin Action / upload-sources-to-crowdin (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Always call resizeCanvas
This commit is contained in:
commit
f125c90c94
|
@ -110,10 +110,12 @@
|
||||||
canvas = wrapper.querySelector("canvas"),
|
canvas = wrapper.querySelector("canvas"),
|
||||||
signaturePad;
|
signaturePad;
|
||||||
|
|
||||||
|
signaturePad = new SignaturePad(canvas);
|
||||||
|
|
||||||
// Adjust canvas coordinate space taking into account pixel ratio,
|
// Adjust canvas coordinate space taking into account pixel ratio,
|
||||||
// to make it look crisp on mobile devices.
|
// to make it look crisp on smaller screens.
|
||||||
// This also causes canvas to be cleared.
|
// https://github.com/szimek/signature_pad#handling-high-dpi-screens
|
||||||
if (window.matchMedia("(min-width: 768px)").matches) {
|
// (This also causes canvas to be cleared.)
|
||||||
function resizeCanvas() {
|
function resizeCanvas() {
|
||||||
// When zoomed out to less than 100%, for some very strange reason,
|
// When zoomed out to less than 100%, for some very strange reason,
|
||||||
// some browsers report devicePixelRatio as less than 1
|
// some browsers report devicePixelRatio as less than 1
|
||||||
|
@ -122,12 +124,10 @@
|
||||||
canvas.width = canvas.offsetWidth * ratio;
|
canvas.width = canvas.offsetWidth * ratio;
|
||||||
canvas.height = canvas.offsetHeight * ratio;
|
canvas.height = canvas.offsetHeight * ratio;
|
||||||
canvas.getContext("2d").scale(ratio, ratio);
|
canvas.getContext("2d").scale(ratio, ratio);
|
||||||
|
signaturePad.clear(); // otherwise isEmpty() might return incorrect value
|
||||||
}
|
}
|
||||||
window.onresize = resizeCanvas;
|
window.onresize = resizeCanvas;
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
}
|
|
||||||
|
|
||||||
signaturePad = new SignaturePad(canvas);
|
|
||||||
|
|
||||||
$('#clear_button').on("click", function (event) {
|
$('#clear_button').on("click", function (event) {
|
||||||
signaturePad.clear();
|
signaturePad.clear();
|
||||||
|
|
Loading…
Reference in a new issue