1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

resizePDF à la fin du redimmensionnement de la fenetre

This commit is contained in:
Vincent LAURENT 2021-10-10 00:43:31 +02:00
parent e9572ac715
commit 45462e4ed9

View File

@ -388,7 +388,7 @@ loadingTask.promise.then(function(pdf) {
canvas.add(svg).renderAll(); canvas.add(svg).renderAll();
}); });
} }
var resizeTimeout;
window.addEventListener('resize', function(event) { window.addEventListener('resize', function(event) {
is_mobile = !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none"); is_mobile = !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none");
if(is_mobile) { if(is_mobile) {
@ -399,13 +399,15 @@ loadingTask.promise.then(function(pdf) {
} }
menu.classList.remove('d-md-block'); menu.classList.remove('d-md-block');
menu.classList.remove('d-none'); menu.classList.remove('d-none');
resizePDF(); clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(resizePDF, 250);
}); });
var resizeInProgress = false;
var resizePDF = function () { var resizePDF = function () {
pdfPages.forEach(function(page, pageIndex) { pdfPages.forEach(function(page, pageIndex) {
var renderTask = pdfRenderTasks[pageIndex]; var renderTask = pdfRenderTasks[pageIndex];
if(!renderTask) { if(!renderTask) {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(resizePDF, 250);
return; return;
} }
var scale = 1.5; var scale = 1.5;