Change scrolling behaviour

This commit is contained in:
caribaud 2023-05-26 23:32:11 +02:00
parent 350b4b0d21
commit c1df87582d
1 changed files with 16 additions and 4 deletions

View File

@ -459,7 +459,19 @@ function handleKeyPress(key){
}
function handleMouseWhell(deltaY){
function handleMouseWhell(event){
// Only handle scroll event if the target is the nav controls
// to avoid preventing page scrolling.
// Do disable page scrolling when we do prev/next, though
if (! READER_FRAME.contains(event.target)){
return
}
event.preventDefault()
event.stopPropagation()
if (MOUSEWHELL_WAIT){
return
@ -470,7 +482,7 @@ function handleMouseWhell(deltaY){
}, MOUSEWHELL_MIN_DELAY)
}
if (deltaY > 0) {
if (event.deltaY > 0) {
moveReader(true, false)
}
@ -497,5 +509,5 @@ addEventListener("keydown", (event) => {
});
addEventListener("wheel", (event) => {
handleMouseWhell(event.deltaY)
});
handleMouseWhell(event)
}, { passive:false });