mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-31 00:08:08 +01:00
Removed horizontal scroll logic from multi-tool template (#2065)
* Removed horizontal scroll logic from multi-tool template * Remove unused horizontalScroll.js
This commit is contained in:
parent
5d40175e18
commit
aa00808219
@ -1,39 +0,0 @@
|
|||||||
const scrollDivHorizontally = (id) => {
|
|
||||||
var scrollDeltaX = 0; // variable to store the accumulated horizontal scroll delta
|
|
||||||
var scrollDeltaY = 0; // variable to store the accumulated vertical scroll delta
|
|
||||||
var isScrolling = false; // variable to track if scroll is already in progress
|
|
||||||
const divToScroll = document.getElementById(id);
|
|
||||||
|
|
||||||
function scrollLoop() {
|
|
||||||
// Scroll the div horizontally and vertically by a fraction of the accumulated scroll delta
|
|
||||||
divToScroll.scrollLeft += scrollDeltaX * 0.1;
|
|
||||||
divToScroll.scrollTop += scrollDeltaY * 0.1;
|
|
||||||
|
|
||||||
// Reduce the accumulated scroll delta by a fraction
|
|
||||||
scrollDeltaX *= 0.9;
|
|
||||||
scrollDeltaY *= 0.9;
|
|
||||||
|
|
||||||
// If scroll delta is still significant, continue the scroll loop
|
|
||||||
if (Math.abs(scrollDeltaX) > 0.1 || Math.abs(scrollDeltaY) > 0.1) {
|
|
||||||
requestAnimationFrame(scrollLoop);
|
|
||||||
} else {
|
|
||||||
isScrolling = false; // Reset scroll in progress flag
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
divToScroll.addEventListener("wheel", function (e) {
|
|
||||||
e.preventDefault(); // prevent default mousewheel behavior
|
|
||||||
|
|
||||||
// Accumulate the horizontal and vertical scroll delta
|
|
||||||
scrollDeltaX -= e.deltaX || e.wheelDeltaX || -e.deltaY || -e.wheelDeltaY;
|
|
||||||
scrollDeltaY -= e.deltaY || e.wheelDeltaY || -e.deltaX || -e.wheelDeltaX;
|
|
||||||
|
|
||||||
// If scroll is not already in progress, start the scroll loop
|
|
||||||
if (!isScrolling) {
|
|
||||||
isScrolling = true;
|
|
||||||
requestAnimationFrame(scrollLoop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export default scrollDivHorizontally;
|
|
@ -80,7 +80,6 @@
|
|||||||
<script type="module">
|
<script type="module">
|
||||||
import PdfContainer from './js/multitool/PdfContainer.js';
|
import PdfContainer from './js/multitool/PdfContainer.js';
|
||||||
import DragDropManager from "./js/multitool/DragDropManager.js";
|
import DragDropManager from "./js/multitool/DragDropManager.js";
|
||||||
import scrollDivHorizontally from "./js/multitool/horizontalScroll.js";
|
|
||||||
import ImageHighlighter from "./js/multitool/ImageHighlighter.js";
|
import ImageHighlighter from "./js/multitool/ImageHighlighter.js";
|
||||||
import PdfActionsManager from './js/multitool/PdfActionsManager.js';
|
import PdfActionsManager from './js/multitool/PdfActionsManager.js';
|
||||||
import FileDragManager from './js/multitool/fileInput.js';
|
import FileDragManager from './js/multitool/fileInput.js';
|
||||||
@ -93,7 +92,6 @@
|
|||||||
const fileDragManager = new FileDragManager();
|
const fileDragManager = new FileDragManager();
|
||||||
|
|
||||||
// Scroll the wrapper horizontally
|
// Scroll the wrapper horizontally
|
||||||
scrollDivHorizontally('pages-container-wrapper');
|
|
||||||
|
|
||||||
// Automatically exposes rotateAll, addFiles and exportPdf to the window for the global buttons.
|
// Automatically exposes rotateAll, addFiles and exportPdf to the window for the global buttons.
|
||||||
const pdfContainer = new PdfContainer(
|
const pdfContainer = new PdfContainer(
|
||||||
|
Loading…
Reference in New Issue
Block a user