1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-06-30 22:50:11 +02:00

address PR feedback

This commit is contained in:
jordy 2023-04-23 09:58:32 +02:00
parent 8f51f025d0
commit 3cb36d36bf

View File

@ -67,7 +67,7 @@
const pagesContainer = document.getElementById("pages-container");
const pagesContainerWrapper = document.getElementById("pages-container-wrapper")
const pageDirection = getComputedStyle(document.body).direction;
const pageDirection = document.documentElement.getAttribute("lang-direction");
var scrollDelta = 0; // variable to store the accumulated scroll delta
var isScrolling = false; // variable to track if scroll is already in progress
@ -106,7 +106,7 @@
*
*/
const imageHighlighter = document.getElementById('image-highlighter');
imageHighlighter.onclick = (e) => {
imageHighlighter.onclick = () => {
imageHighlighter.childNodes.forEach((child) => {
child.classList.add('remove');
setTimeout(() => {
@ -115,6 +115,18 @@
})
}
const imageHighlightCallback = (highlightEvent) => {
var bigImg = document.createElement('img');
bigImg.onclick = (imageClickEvent) => {
// This prevents the highlighter's onClick from closing the image when clicking on the image
// instead of next to it.
imageClickEvent.preventDefault();
imageClickEvent.stopPropagation();
};
bigImg.src = highlightEvent.target.src;
imageHighlighter.appendChild(bigImg);
}
/**
*
* Methods for managing PDFs
@ -227,15 +239,7 @@
/**
* Making pages larger when clicking on them
*/
img.addEventListener('mousedown', (x) => {
var bigImg = document.createElement('img');
bigImg.onclick = (e) => {
e.preventDefault();
e.stopPropagation();
};
bigImg.src = imageSrc;
imageHighlighter.appendChild(bigImg);
})
img.addEventListener('click',imageHighlightCallback)
/**
* Rendering the various buttons to manipulate and move pdf pages