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:
Devin AI 2025-09-05 21:54:54 +00:00
parent c0910cf4f1
commit b2d8a39b01
1 changed files with 10 additions and 2 deletions

View File

@ -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);
}
};