fix(home-slider): restore desktop mouse hover tracking, isolate slider from link navigation, and fix touch drag math

This commit is contained in:
2026-11-05 13:20:36 +05:30
parent ee518ff451
commit 7760722c76
3 changed files with 147 additions and 89 deletions
+8 -1
View File
@@ -82,7 +82,7 @@ export function Cinematic3DComparison({
};
}, [autoSlide, isDragging, updatePosition]);
// Unified Pointer Handlers on the Slider Arrows Handle
// Unified Pointer Handlers
const handlePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
if (e.button !== 0 && e.pointerType === 'mouse') return;
e.stopPropagation();
@@ -105,6 +105,12 @@ export function Cinematic3DComparison({
}
};
const handleContainerPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
// On desktop with mouse, clicking anywhere on the stage moves the slider
if (e.pointerType !== 'mouse' || e.button !== 0) return;
handlePointerDown(e);
};
const handlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
if (!isPointerDownRef.current) return;
e.stopPropagation();
@@ -167,6 +173,7 @@ export function Cinematic3DComparison({
{/* 3D Kinetic Tilt Stage - Allows smooth page scrolling when touching anywhere except the arrows handle */}
<div
ref={containerRef}
onPointerDown={handleContainerPointerDown}
className={`relative w-full ${aspectRatio} rounded-2xl sm:rounded-3xl overflow-hidden preserve-3d transition-transform duration-150 ease-out shadow-cinematic-3d hover:shadow-cinematic-hover border border-slate-900/[0.08] bg-slate-950`}
style={{
'--split': '50%',