fix: [esign] 그룹 드래그 후 선택 해제되는 문제 수정
- 드래그 완료 후 click 이벤트에서 선택 변경 무시 - 여백 클릭 시에만 그룹 선택 해제
This commit is contained in:
@@ -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 (
|
||||
<div ref={fieldRef}
|
||||
onClick={(e) => { 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',
|
||||
|
||||
Reference in New Issue
Block a user