Change scrolling behaviour
This commit is contained in:
parent
350b4b0d21
commit
c1df87582d
20
melpomene.js
20
melpomene.js
|
@ -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 });
|
||||
|
|
Loading…
Reference in New Issue