mirror of
https://github.com/24eme/signaturepdf.git
synced 2023-08-25 09:33:08 +02:00
5 page per ligne and hide bar when drag and drop
This commit is contained in:
parent
d51f31109f
commit
a31eb7852a
@ -4,7 +4,7 @@ var windowWidth = window.innerWidth;
|
||||
var is_mobile = function() {
|
||||
return !(window.getComputedStyle(document.getElementById('is_mobile')).display === "none");
|
||||
};
|
||||
var nbPagePerLine = 4;
|
||||
var nbPagePerLine = 5;
|
||||
if(is_mobile()) {
|
||||
nbPagePerLine = 2;
|
||||
}
|
||||
@ -25,7 +25,7 @@ var loadPDF = async function(pdfBlob, filename) {
|
||||
for(var pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++ ) {
|
||||
pdf.getPage(pageNumber).then(function(page) {
|
||||
let viewport = page.getViewport({scale: 1});
|
||||
let scale = (document.getElementById('container-pages').clientWidth - (8*nbPagePerLine) - 10) / viewport.width / nbPagePerLine;
|
||||
let scale = (document.getElementById('container-pages').clientWidth - (8*nbPagePerLine) - 12) / viewport.width / nbPagePerLine;
|
||||
viewport = page.getViewport({scale: scale});
|
||||
|
||||
var pageIndex = page.pageNumber - 1;
|
||||
@ -37,10 +37,12 @@ var loadPDF = async function(pdfBlob, filename) {
|
||||
this.querySelector('.canvas-pdf').classList.add('shadow-lg');
|
||||
e.dataTransfer.setData('element', this.id);
|
||||
this.querySelector('.canvas-pdf').style.opacity = 0.4;
|
||||
document.querySelector('#container-bar').classList.add('d-none');
|
||||
});
|
||||
canvasContainer.addEventListener('dragend', function(e) {
|
||||
this.querySelector('.canvas-pdf').classList.remove('shadow-lg');
|
||||
this.querySelector('.canvas-pdf').style.opacity = 1;
|
||||
document.querySelector('#container-bar').classList.remove('d-none');
|
||||
});
|
||||
canvasContainer.addEventListener('dragover', function(e) {
|
||||
if (e.preventDefault) {
|
||||
|
@ -32,7 +32,7 @@
|
||||
<div id="page-organization" class="d-none">
|
||||
<div id="container-pages" class="col-12 pt-1 vh-100" style="padding-bottom: 60px;">
|
||||
</div>
|
||||
<div class="position-fixed bottom-0 start-0 bg-white w-100 p-2 shadow-lg">
|
||||
<div id="container-bar" class="position-fixed bottom-0 start-0 bg-white w-100 p-2 shadow-lg">
|
||||
<form id="form_pdf" action="/organize" method="post" enctype="multipart/form-data">
|
||||
<input id="input_pdf" name="pdf" type="file" class="d-none" />
|
||||
<input id="input_pages" type="hidden" value="" name="pages" />
|
||||
@ -67,6 +67,6 @@
|
||||
<script>
|
||||
var maxSize = <?php echo $maxSize ?>;
|
||||
</script>
|
||||
<script src="/js/organization.js?202203261059"></script>
|
||||
<script src="/js/organization.js?202203301018"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user