diff --git a/resources/views/esign/template-fields.blade.php b/resources/views/esign/template-fields.blade.php index a2f24aac..684ba4a2 100644 --- a/resources/views/esign/template-fields.blade.php +++ b/resources/views/esign/template-fields.blade.php @@ -134,6 +134,7 @@ className={`w-full relative rounded border-2 transition-all ${p === currentPage const FieldOverlay = ({ field, index, selected, signerCount, containerRef, onSelect, onUpdate, onDragEnd, gridEnabled, selectedIndices, onGroupMove }) => { const fieldRef = useRef(null); const [resizeMode, setResizeMode] = useState(false); + const draggedRef = useRef(false); const latestRef = useRef({ field, index, onUpdate, onDragEnd, selectedIndices, onGroupMove }); latestRef.current = { field, index, onUpdate, onDragEnd, selectedIndices, onGroupMove }; @@ -205,6 +206,7 @@ className={`w-full relative rounded border-2 transition-all ${p === currentPage modifiers, listeners: { move(event) { + draggedRef.current = true; const { field: f, index: idx, onUpdate: update, selectedIndices: si, onGroupMove: groupMove } = latestRef.current; const rect = containerRef.current.getBoundingClientRect(); const dx = (event.dx / rect.width) * 100; @@ -217,7 +219,10 @@ className={`w-full relative rounded border-2 transition-all ${p === currentPage update(idx, { position_x: round2(newX), position_y: round2(newY) }); } }, - end() { latestRef.current.onDragEnd(); }, + end() { + latestRef.current.onDragEnd(); + setTimeout(() => { draggedRef.current = false; }, 0); + }, }, }); } @@ -227,7 +232,7 @@ className={`w-full relative rounded border-2 transition-all ${p === currentPage return (
{ e.stopPropagation(); onSelect(index, e); }} + onClick={(e) => { e.stopPropagation(); if (draggedRef.current) return; onSelect(index, e); }} onDoubleClick={(e) => { e.stopPropagation(); onSelect(index, e); setResizeMode(prev => !prev); }} style={{ position: 'absolute',