mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
4a5f65616f
|
@ -110,25 +110,25 @@
|
||||||
canvas = wrapper.querySelector("canvas"),
|
canvas = wrapper.querySelector("canvas"),
|
||||||
signaturePad;
|
signaturePad;
|
||||||
|
|
||||||
// Adjust canvas coordinate space taking into account pixel ratio,
|
|
||||||
// to make it look crisp on mobile devices.
|
|
||||||
// This also causes canvas to be cleared.
|
|
||||||
if (window.matchMedia("(min-width: 768px)").matches) {
|
|
||||||
function resizeCanvas() {
|
|
||||||
// When zoomed out to less than 100%, for some very strange reason,
|
|
||||||
// some browsers report devicePixelRatio as less than 1
|
|
||||||
// and only part of the canvas is cleared then.
|
|
||||||
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
||||||
canvas.width = canvas.offsetWidth * ratio;
|
|
||||||
canvas.height = canvas.offsetHeight * ratio;
|
|
||||||
canvas.getContext("2d").scale(ratio, ratio);
|
|
||||||
}
|
|
||||||
window.onresize = resizeCanvas;
|
|
||||||
resizeCanvas();
|
|
||||||
}
|
|
||||||
|
|
||||||
signaturePad = new SignaturePad(canvas);
|
signaturePad = new SignaturePad(canvas);
|
||||||
|
|
||||||
|
// Adjust canvas coordinate space taking into account pixel ratio,
|
||||||
|
// to make it look crisp on smaller screens.
|
||||||
|
// https://github.com/szimek/signature_pad#handling-high-dpi-screens
|
||||||
|
// (This also causes canvas to be cleared.)
|
||||||
|
function resizeCanvas() {
|
||||||
|
// When zoomed out to less than 100%, for some very strange reason,
|
||||||
|
// some browsers report devicePixelRatio as less than 1
|
||||||
|
// and only part of the canvas is cleared then.
|
||||||
|
var ratio = Math.max(window.devicePixelRatio || 1, 1);
|
||||||
|
canvas.width = canvas.offsetWidth * ratio;
|
||||||
|
canvas.height = canvas.offsetHeight * ratio;
|
||||||
|
canvas.getContext("2d").scale(ratio, ratio);
|
||||||
|
signaturePad.clear(); // otherwise isEmpty() might return incorrect value
|
||||||
|
}
|
||||||
|
window.onresize = resizeCanvas;
|
||||||
|
resizeCanvas();
|
||||||
|
|
||||||
$('#clear_button').on("click", function (event) {
|
$('#clear_button').on("click", function (event) {
|
||||||
signaturePad.clear();
|
signaturePad.clear();
|
||||||
});
|
});
|
||||||
|
@ -144,4 +144,4 @@
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@stop
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue