diff --git a/packages/editor/src/components/tools/wall/wall-tool.tsx b/packages/editor/src/components/tools/wall/wall-tool.tsx index 4a58c4ab..c5fa0f33 100644 --- a/packages/editor/src/components/tools/wall/wall-tool.tsx +++ b/packages/editor/src/components/tools/wall/wall-tool.tsx @@ -5,7 +5,7 @@ import { DoubleSide, type Group, type Mesh, Shape, ShapeGeometry, Vector3 } from import { EDITOR_LAYER } from '../../../lib/constants' import { sfxEmitter } from '../../../lib/sfx-bus' import { CursorSphere } from '../shared/cursor-sphere' -import { createWallOnCurrentLevel, snapWallDraftPoint, type WallPlanPoint } from './wall-drafting' +import { createWallOnCurrentLevel, snapWallDraftPoint, WALL_MIN_LENGTH, type WallPlanPoint } from './wall-drafting' const WALL_HEIGHT = 2.5 @@ -17,7 +17,7 @@ const updateWallPreview = (mesh: Mesh, start: Vector3, end: Vector3) => { const direction = new Vector3(end.x - start.x, 0, end.z - start.z) const length = direction.length() - if (length < 0.01) { + if (length < WALL_MIN_LENGTH) { mesh.visible = false return } @@ -142,7 +142,7 @@ export const WallTool: React.FC = () => { endingPoint.current.set(snappedEnd[0], event.position[1], snappedEnd[1]) const dx = endingPoint.current.x - startingPoint.current.x const dz = endingPoint.current.z - startingPoint.current.z - if (dx * dx + dz * dz < 0.01 * 0.01) return + if (dx * dx + dz * dz < WALL_MIN_LENGTH * WALL_MIN_LENGTH) return createWallOnCurrentLevel( [startingPoint.current.x, startingPoint.current.z], [endingPoint.current.x, endingPoint.current.z],