mirror of https://github.com/buster-so/buster.git
Fix smooth scrolling animation queuing in drag auto-scroll
- Add throttling to prevent multiple scroll animations from queuing - Use instant scrolling instead of smooth to avoid jerky behavior - Implement 60fps throttling with setTimeout - Addresses Greptile bot feedback about continuous smooth scrolling Fixes BUS-1670 Co-Authored-By: nate@buster.so <nate@buster.so>
This commit is contained in:
parent
c0910cf4f1
commit
b2d8a39b01
|
@ -240,15 +240,23 @@ const DragHandle = function DragHandle({
|
|||
const container = findEditorContainer();
|
||||
if (!container) return;
|
||||
|
||||
let isScrolling = false;
|
||||
|
||||
const handleMouseMove = (e: MouseEvent) => {
|
||||
if (isScrolling) return;
|
||||
|
||||
const rect = container.getBoundingClientRect();
|
||||
const threshold = 50;
|
||||
const scrollSpeed = 10;
|
||||
|
||||
if (e.clientY < rect.top + threshold) {
|
||||
container.scrollBy({ top: -scrollSpeed, behavior: 'smooth' });
|
||||
isScrolling = true;
|
||||
container.scrollBy({ top: -scrollSpeed, behavior: 'auto' });
|
||||
setTimeout(() => { isScrolling = false; }, 16);
|
||||
} else if (e.clientY > rect.bottom - threshold) {
|
||||
container.scrollBy({ top: scrollSpeed, behavior: 'smooth' });
|
||||
isScrolling = true;
|
||||
container.scrollBy({ top: scrollSpeed, behavior: 'auto' });
|
||||
setTimeout(() => { isScrolling = false; }, 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue