Improve scrolling behavior in video category rows for smoother navigation
Adjusted scroll thresholds in `netflix-grid.tsx` to prevent premature infinite loop behavior on category rows, enhancing user experience. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/P3O2FU7
This commit is contained in:
parent
8af8f06fe2
commit
8997338812
@ -146,14 +146,14 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
||||
let targetScroll;
|
||||
|
||||
if (direction === 'left') {
|
||||
if (currentScroll <= 0) {
|
||||
if (currentScroll <= 5) {
|
||||
// Jump to end for infinite loop
|
||||
targetScroll = maxScroll;
|
||||
} else {
|
||||
targetScroll = Math.max(0, currentScroll - scrollAmount);
|
||||
}
|
||||
} else {
|
||||
if (currentScroll >= maxScroll - 10) {
|
||||
if (currentScroll >= maxScroll - 50) {
|
||||
// Jump to beginning for infinite loop
|
||||
targetScroll = 0;
|
||||
} else {
|
||||
@ -178,10 +178,10 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
||||
const maxScroll = scrollRef.current.scrollWidth - scrollRef.current.clientWidth;
|
||||
const scrollAmount = direction === 'left' ? -3 : 3; // Faster scroll
|
||||
|
||||
if (direction === 'left' && currentScroll <= 0) {
|
||||
if (direction === 'left' && currentScroll <= 5) {
|
||||
// Jump to end for infinite loop
|
||||
scrollRef.current.scrollLeft = maxScroll;
|
||||
} else if (direction === 'right' && currentScroll >= maxScroll - 5) {
|
||||
} else if (direction === 'right' && currentScroll >= maxScroll - 50) {
|
||||
// Jump to beginning for infinite loop
|
||||
scrollRef.current.scrollLeft = 0;
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user