Refactor drag control management: conditionally enable drag controls based on tool mode and ensure proper cleanup on unmount.
This commit is contained in:
parent
c0a7eebecb
commit
c7f0b7f84d
|
@ -31,7 +31,15 @@ const FloorPlanGroup = ({ floorPlanGroup, floorPlanGroupLine, floorPlanGroupPoin
|
|||
const { socket } = useSocketStore();
|
||||
|
||||
useEffect(() => {
|
||||
addDragControl(dragPointControls, currentLayerPoint, state, floorPlanGroupPoint, floorPlanGroupLine, lines, onlyFloorlines, socket);
|
||||
if (toolMode === 'move') {
|
||||
addDragControl(dragPointControls, currentLayerPoint, state, floorPlanGroupPoint, floorPlanGroupLine, lines, onlyFloorlines, socket);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (dragPointControls.current) {
|
||||
dragPointControls.current.enabled = false;
|
||||
}
|
||||
};
|
||||
}, [toolMode, state]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in New Issue