mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
Mutualisation de code, scroll sur la div en mode desktop
This commit is contained in:
parent
5b2ae3a80e
commit
08465b5d4e
@ -18,17 +18,32 @@ loadingTask.promise.then(function(pdf) {
|
|||||||
var pdfRenderTasks = [];
|
var pdfRenderTasks = [];
|
||||||
var pdfPages = [];
|
var pdfPages = [];
|
||||||
var svgCollections = [];
|
var svgCollections = [];
|
||||||
var is_mobile = !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none");
|
var resizeTimeout;
|
||||||
|
var currentScale = 1.5;
|
||||||
|
var windowWidth = window.innerWidth;
|
||||||
var menu = document.getElementById('offcanvasTop')
|
var menu = document.getElementById('offcanvasTop')
|
||||||
var menuOffcanvas = new bootstrap.Offcanvas(menu)
|
var menuOffcanvas = new bootstrap.Offcanvas(menu)
|
||||||
|
|
||||||
if(is_mobile) {
|
var is_mobile = function() {
|
||||||
menu.classList.remove('show');
|
return !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none");
|
||||||
menuOffcanvas.hide();
|
|
||||||
}
|
}
|
||||||
menu.classList.remove('d-md-block');
|
|
||||||
menu.classList.remove('d-none');
|
var responsiveDisplay = function() {
|
||||||
|
if(is_mobile()) {
|
||||||
|
document.body.style.paddingRight = "";
|
||||||
|
menu.classList.remove('show');
|
||||||
|
menuOffcanvas.hide();
|
||||||
|
document.getElementById('container-pages').classList.remove('vh-100');
|
||||||
|
} else {
|
||||||
|
menuOffcanvas.show();
|
||||||
|
document.body.style.paddingRight = "350px";
|
||||||
|
document.getElementById('container-pages').classList.add('vh-100');
|
||||||
|
}
|
||||||
|
menu.classList.remove('d-md-block');
|
||||||
|
menu.classList.remove('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
|
responsiveDisplay();
|
||||||
|
|
||||||
if(localStorage.getItem('svgCollections')) {
|
if(localStorage.getItem('svgCollections')) {
|
||||||
svgCollections = JSON.parse(localStorage.getItem('svgCollections'));
|
svgCollections = JSON.parse(localStorage.getItem('svgCollections'));
|
||||||
@ -64,7 +79,7 @@ loadingTask.promise.then(function(pdf) {
|
|||||||
canvasEdition.defaultCursor = 'default';
|
canvasEdition.defaultCursor = 'default';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(is_mobile) {
|
if(is_mobile()) {
|
||||||
menuOffcanvas.hide();
|
menuOffcanvas.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -407,25 +422,14 @@ loadingTask.promise.then(function(pdf) {
|
|||||||
canvas.add(svg).renderAll();
|
canvas.add(svg).renderAll();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var resizeTimeout;
|
|
||||||
var currentScale = 1.5;
|
|
||||||
var windowWidth = window.innerWidth;
|
|
||||||
window.addEventListener('resize', function(event) {
|
window.addEventListener('resize', function(event) {
|
||||||
event.preventDefault() && event.stopPropagation();
|
event.preventDefault() && event.stopPropagation();
|
||||||
if(windowWidth == window.innerWidth) {
|
if(windowWidth == window.innerWidth) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
responsiveDisplay();
|
||||||
windowWidth = window.innerWidth;
|
windowWidth = window.innerWidth;
|
||||||
is_mobile = !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none");
|
|
||||||
if(is_mobile) {
|
|
||||||
menu.classList.remove('show');
|
|
||||||
menuOffcanvas.hide();
|
|
||||||
} else {
|
|
||||||
menuOffcanvas.show();
|
|
||||||
}
|
|
||||||
menu.classList.remove('d-md-block');
|
|
||||||
menu.classList.remove('d-none');
|
|
||||||
|
|
||||||
autoZoom();
|
autoZoom();
|
||||||
});
|
});
|
||||||
document.addEventListener('wheel', function(event) {
|
document.addEventListener('wheel', function(event) {
|
||||||
|
@ -23,15 +23,12 @@
|
|||||||
</style>
|
</style>
|
||||||
<title>Signature PDF</title>
|
<title>Signature PDF</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-light">
|
<body class="bg-light" style="padding-right: 350px;">
|
||||||
<div class="container-fluid">
|
|
||||||
<div style="height: 65px;" class="d-md-none"></div>
|
<div style="height: 65px;" class="d-md-none"></div>
|
||||||
<div class="row">
|
<div id="container-pages" style="overflow: auto" class="col-12 pt-1 pb-1 text-center vh-100">
|
||||||
<div id="container-pages" style="overflow-x: auto" class="col-xxl-9 col-xl-8 col-lg-7 col-md-6 col-sm-12 col-xs-12 pt-1 pb-1 text-center">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 55px;" class="d-md-none"></div>
|
<div style="height: 55px;" class="d-md-none"></div>
|
||||||
<div class="offcanvas offcanvas-end show d-none d-md-block shadow-sm" data-bs-backdrop="false" data-bs-scroll="true" data-keyboard="false" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel">
|
<div class="offcanvas offcanvas-end show d-none d-md-block shadow-sm" data-bs-backdrop="false" data-bs-scroll="true" data-keyboard="false" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel" style="width: 350px;">
|
||||||
<div class="offcanvas-header">
|
<div class="offcanvas-header">
|
||||||
<h5 id="offcanvasTopLabel">Signature du PDF</h5>
|
<h5 id="offcanvasTopLabel">Signature du PDF</h5>
|
||||||
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
<button type="button" class="btn-close text-reset d-md-none" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||||
@ -126,7 +123,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<span id="is_mobile" class="d-md-none"></span>
|
<span id="is_mobile" class="d-md-none"></span>
|
||||||
|
|
||||||
<script src="/vendor/bootstrap.min.js?5.1.1"></script>
|
<script src="/vendor/bootstrap.min.js?5.1.1"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user