diff --git a/components/lib/scrollpanel/ScrollPanel.js b/components/lib/scrollpanel/ScrollPanel.js index 66a33744f2..d4bda412cc 100644 --- a/components/lib/scrollpanel/ScrollPanel.js +++ b/components/lib/scrollpanel/ScrollPanel.js @@ -84,9 +84,9 @@ export const ScrollPanel = React.forwardRef((props, ref) => { }; const onDocumentMouseMove = (event) => { - if (isXBarClicked) { + if (isXBarClicked.current) { onMouseMoveForXBar(event); - } else if (isYBarClicked) { + } else if (isYBarClicked.current) { onMouseMoveForYBar(event); } else { onMouseMoveForXBar(event); @@ -105,7 +105,7 @@ export const ScrollPanel = React.forwardRef((props, ref) => { const onMouseMoveForYBar = (event) => { const deltaY = event.pageY - lastPageY.current; - lastPageY.current = e.pageY; + lastPageY.current = event.pageY; frame.current = window.requestAnimationFrame(() => { contentRef.current.scrollTop += deltaY / scrollYRatio.current;