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

Click on page to select it

This commit is contained in:
Vincent LAURENT 2022-10-07 19:50:25 +02:00
parent 3bc1343701
commit ad7439a419
2 changed files with 11 additions and 1 deletions

View File

@ -84,6 +84,9 @@ var loadPDF = async function(pdfBlob, filename, pdfIndex) {
let canvasContainer = document.getElementById('canvas-container-' + pageIndex); let canvasContainer = document.getElementById('canvas-container-' + pageIndex);
canvasContainer.addEventListener('click', function(e) { canvasContainer.addEventListener('click', function(e) {
if(!is_mobile() && !isPageDeleted(this) && !isPageDragged(this)) {
canvasContainer.querySelector('.btn-select').click();
}
if(!is_mobile()) { if(!is_mobile()) {
return; return;
} }
@ -158,15 +161,19 @@ var loadPDF = async function(pdfBlob, filename, pdfIndex) {
return false; return false;
}); });
canvasContainer.querySelector('.btn-delete').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-delete').addEventListener('click', function(e) {
e.stopPropagation();
toggleDeletePage(this.parentNode); toggleDeletePage(this.parentNode);
}); });
canvasContainer.querySelector('.btn-restore').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-restore').addEventListener('click', function(e) {
e.stopPropagation();
toggleDeletePage(this.parentNode); toggleDeletePage(this.parentNode);
}); });
canvasContainer.querySelector('.btn-select').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-select').addEventListener('click', function(e) {
e.stopPropagation();
toggleSelectPage(this.parentNode); toggleSelectPage(this.parentNode);
}); });
canvasContainer.querySelector('.btn-drag').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-drag').addEventListener('click', function(e) {
e.stopPropagation();
toggleDragPage(this.parentNode); toggleDragPage(this.parentNode);
}); });
canvasContainer.querySelector('.btn-drag-here').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-drag-here').addEventListener('click', function(e) {
@ -196,9 +203,11 @@ var loadPDF = async function(pdfBlob, filename, pdfIndex) {
}); });
}); });
canvasContainer.querySelector('.btn-cancel').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-cancel').addEventListener('click', function(e) {
e.stopPropagation();
toggleDragPage(this.parentNode); toggleDragPage(this.parentNode);
}); });
canvasContainer.querySelector('.btn-download').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-download').addEventListener('click', function(e) {
e.stopPropagation();
let container = this.parentNode; let container = this.parentNode;
let pageValue = container.querySelector('.checkbox-page').value; let pageValue = container.querySelector('.checkbox-page').value;
let orientation = degreesToOrientation(container.querySelector('.input-rotate').value); let orientation = degreesToOrientation(container.querySelector('.input-rotate').value);
@ -209,6 +218,7 @@ var loadPDF = async function(pdfBlob, filename, pdfIndex) {
document.querySelector('#form_pdf').submit(); document.querySelector('#form_pdf').submit();
}); });
canvasContainer.querySelector('.btn-rotate').addEventListener('click', function(e) { canvasContainer.querySelector('.btn-rotate').addEventListener('click', function(e) {
e.stopPropagation();
let inputRotate = this.parentNode.querySelector('.input-rotate'); let inputRotate = this.parentNode.querySelector('.input-rotate');
inputRotate.value = (parseInt(inputRotate.value) + 90) % 360; inputRotate.value = (parseInt(inputRotate.value) + 90) % 360;
pageRender(pageIndex); pageRender(pageIndex);

View File

@ -104,6 +104,6 @@
<script> <script>
var maxSize = <?php echo $maxSize ?>; var maxSize = <?php echo $maxSize ?>;
</script> </script>
<script src="/js/organization.js?2022100701047"></script> <script src="/js/organization.js?2022100701950"></script>
</body> </body>
</html> </html>