Properly detect scrollbar for mouse drag scrolling

This commit is contained in:
schroda
2025-02-04 20:32:37 +01:00
parent 2ec42d962a
commit 36cb545156

View File

@@ -150,7 +150,10 @@ export const useMouseDragScroll = (
return true;
}
const hasScrollBar = [element.clientWidth >= window.innerWidth, element.clientHeight >= window.innerHeight];
const hasScrollBar = [
element.clientHeight < element.scrollHeight,
element.clientWidth < element.scrollWidth,
];
const didPosChange = [
Math.abs(previousClickPosX.current[LATEST] - e.pageX) > 0,
Math.abs(previousClickPosY.current[LATEST] - e.pageY) > 0,