mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
parent
de97fd7334
commit
ffc78442f1
|
@ -366,11 +366,26 @@ async function webviewPreloads(ctx: PreloadContext) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// scroll up
|
||||
if (event.deltaY < 0 && node.scrollTop > 0) {
|
||||
// there is still some content to scroll
|
||||
return true;
|
||||
}
|
||||
|
||||
// scroll down
|
||||
if (event.deltaY > 0 && node.scrollTop + node.clientHeight < node.scrollHeight) {
|
||||
// per https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight
|
||||
// scrollTop is not rounded but scrollHeight and clientHeight are
|
||||
// so we need to check if the difference is less than some threshold
|
||||
if (node.scrollHeight - node.scrollTop - node.clientHeight < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if the node is not scrollable, we can continue. We don't check the computed style always as it's expensive
|
||||
if (window.getComputedStyle(node).overflowY === 'hidden' || window.getComputedStyle(node).overflowY === 'visible') {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue