Skip to content

Commit 1a9922a

Browse files
authored
Merge pull request #1011 from trycompai/main
[comp] Production Deploy
2 parents ea49d25 + 5722cd7 commit 1a9922a

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

apps/app/src/app/(app)/setup/components/AnimatedGradientBackground.tsx

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -340,28 +340,37 @@ function AnimatedOrb({ scale = 1 }: AnimatedOrbProps) {
340340
let scrollTimeout: NodeJS.Timeout;
341341

342342
const handleScroll = (e: WheelEvent) => {
343-
e.preventDefault(); // Prevent page scroll when over the orb
344-
345-
// Calculate scroll velocity
346-
const scrollDelta = e.deltaY * 0.001;
347-
scrollVelocity.current += scrollDelta;
348-
349-
// Add to target rotation
350-
targetScrollRotation.current += scrollDelta * 2;
343+
// Check if the user is interacting with an interactive element
344+
const target = e.target as HTMLElement;
345+
const isInteractiveElement = target.closest(
346+
'input, textarea, select, button, [role="combobox"], [role="listbox"], ' +
347+
'[data-radix-collection-item], [data-state], .overflow-auto, .overflow-y-auto, ' +
348+
'.overflow-x-auto, .overflow-scroll, .overflow-y-scroll, .overflow-x-scroll',
349+
);
350+
351+
// Only apply the orb effect if not scrolling on an interactive element
352+
if (!isInteractiveElement) {
353+
// Calculate scroll velocity for orb rotation
354+
const scrollDelta = e.deltaY * 0.001;
355+
scrollVelocity.current += scrollDelta;
356+
357+
// Add to target rotation
358+
targetScrollRotation.current += scrollDelta * 2;
359+
360+
// Clear existing timeout
361+
if (scrollTimeout) {
362+
clearTimeout(scrollTimeout);
363+
}
351364

352-
// Clear existing timeout
353-
if (scrollTimeout) {
354-
clearTimeout(scrollTimeout);
365+
// Start decay after scrolling stops
366+
scrollTimeout = setTimeout(() => {
367+
scrollVelocity.current = 0;
368+
}, 150);
355369
}
356-
357-
// Start decay after scrolling stops
358-
scrollTimeout = setTimeout(() => {
359-
scrollVelocity.current = 0;
360-
}, 150);
361370
};
362371

363372
// Use wheel event for better scroll detection
364-
window.addEventListener('wheel', handleScroll, { passive: false });
373+
window.addEventListener('wheel', handleScroll, { passive: true });
365374

366375
return () => {
367376
window.removeEventListener('wheel', handleScroll);

0 commit comments

Comments
 (0)