fix: improve stitch cut line dragging

This commit is contained in:
Your Name 2026-05-28 21:18:49 +08:00
parent 1cf4cf3ac0
commit 1487531b8c

View File

@ -583,6 +583,12 @@ export function AgentDetailReferenceStitchDialog({
const handleLinePointerDown = useCallback(
(index: number) => (event: ReactPointerEvent<HTMLDivElement>) => {
event.preventDefault();
event.stopPropagation();
try {
event.currentTarget.setPointerCapture(event.pointerId);
} catch {
// Older browsers may not support pointer capture for this target.
}
setDraggingLineIndex(index);
},
[]
@ -876,7 +882,7 @@ export function AgentDetailReferenceStitchDialog({
<div
onPointerDown={handleLinePointerDown(index)}
className={cn(
"pointer-events-auto absolute inset-x-0 z-10 flex -translate-y-1/2 cursor-row-resize items-center justify-center",
"pointer-events-auto absolute inset-x-0 z-10 flex h-10 -translate-y-1/2 cursor-row-resize touch-none select-none items-center justify-center",
draggingLineIndex === index && "z-20"
)}
style={{ touchAction: "none" }}