refactor: Implement point snapping functionality and enhance aisle management with new snapping logic and state management
This commit is contained in:
@@ -6,7 +6,7 @@ import { DragControls } from '@react-three/drei';
|
||||
import { useAisleStore } from '../../../store/builder/useAisleStore';
|
||||
import { useThree } from '@react-three/fiber';
|
||||
import { useBuilderStore } from '../../../store/builder/useBuilderStore';
|
||||
import { usePointSnapping } from './usePointSnapping';
|
||||
import { usePointSnapping } from './helpers/usePointSnapping';
|
||||
|
||||
function Point({ point }: { readonly point: Point }) {
|
||||
const materialRef = useRef<THREE.ShaderMaterial>(null);
|
||||
@@ -15,7 +15,7 @@ function Point({ point }: { readonly point: Point }) {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const { toolMode } = useToolMode();
|
||||
const { setPosition, removePoint } = useAisleStore();
|
||||
const { checkSnapForAisle } = usePointSnapping(point);
|
||||
const { checkSnapForAisle } = usePointSnapping({ uuid: point.uuid, pointType: point.pointType, position: point.position });
|
||||
const { hoveredPoint, setHoveredPoint } = useBuilderStore();
|
||||
const { deletePointOrLine } = useDeletePointOrLine();
|
||||
|
||||
@@ -60,7 +60,7 @@ function Point({ point }: { readonly point: Point }) {
|
||||
const newPosition: [number, number, number] = [position.x, position.y, position.z];
|
||||
const snappedPosition = checkSnapForAisle(newPosition);
|
||||
|
||||
setPosition(point.uuid, snappedPosition);
|
||||
setPosition(point.uuid, snappedPosition.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user