I was thinking that instead of dealing with a render implementation to show a continuous stream of pages. Most of us would be perfectly happy with vertical scrolling I suppose. At least I would. This way you wouldn't have to rewrite so much code.
I've quickly hacked together this working prototype.
const debounce = function (fn, d) {
let timer;
return function () {
let context = this;
let args = arguments;
clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(context, args);
}, d);
}
};
const pdfView = document.getElementById('siac-pdf-overflow');
const onWheelLogic = function () {
if (myDiv.offsetHeight + pdfView.scrollTop >= pdfView.scrollHeight) {
pdfPageRight();
}
if (!pdfView.scrollTop) {
pdfPageLeft();
// This is terrible ofc. Should be integrated into pdfPageLeft instead of using a timeout.
setTimeout(() => {
pdfView.scrollTop = pdfView.scrollHeight;
}, 100);
}
};
pdfView.addEventListener('wheel', debounce(onWheelLogic, 200));
I was thinking that instead of dealing with a render implementation to show a continuous stream of pages. Most of us would be perfectly happy with vertical scrolling I suppose. At least I would. This way you wouldn't have to rewrite so much code.
I've quickly hacked together this working prototype.