From b2ed93abc02ab4b5559347a8a2bc3ead282fcc64 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Mon, 15 Sep 2025 11:30:02 +0530 Subject: [PATCH] added screenSizer to line --- app/src/modules/builder/line/line.tsx | 14 ++++++------- .../builder/line/reference/referenceLine.tsx | 21 ++++++------------- app/src/types/world/worldConstants.ts | 2 ++ 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/app/src/modules/builder/line/line.tsx b/app/src/modules/builder/line/line.tsx index 23f9525..c2844cc 100644 --- a/app/src/modules/builder/line/line.tsx +++ b/app/src/modules/builder/line/line.tsx @@ -1,6 +1,6 @@ import * as THREE from "three"; import { useMemo } from "react"; -import { DragControls, Tube } from "@react-three/drei"; +import { DragControls, Line as DreiLine } from "@react-three/drei"; import * as Constants from "../../../types/world/worldConstants"; import { useLineEventHandler } from "./eventHandler/useLineEventHandler"; @@ -14,7 +14,7 @@ function Line({ points }: Readonly) { const [start, end] = points.map((p) => new THREE.Vector3(...p.position)); return new THREE.LineCurve3(start, end); }, [points]); - + const positions = useMemo(() => points.map((p) => new THREE.Vector3(...p.position)), [points]); const colors = getColor(points[0]); function getColor(point: Point) { @@ -50,18 +50,18 @@ function Line({ points }: Readonly) { return ( - - - + /> ); } diff --git a/app/src/modules/builder/line/reference/referenceLine.tsx b/app/src/modules/builder/line/reference/referenceLine.tsx index 12ba6a4..0a9b2f2 100644 --- a/app/src/modules/builder/line/reference/referenceLine.tsx +++ b/app/src/modules/builder/line/reference/referenceLine.tsx @@ -1,25 +1,16 @@ -import * as THREE from 'three'; import { useMemo } from "react"; -import * as Constants from '../../../../types/world/worldConstants'; -import { Tube } from '@react-three/drei'; +import * as THREE from "three"; +import { Line as DreiLine } from "@react-three/drei"; +import * as Constants from "../../../../types/world/worldConstants"; interface ReferenceLineProps { points: [Point, Point]; } function ReferenceLine({ points }: Readonly) { - const path = useMemo(() => { - const [start, end] = points.map(p => new THREE.Vector3(...p.position)); - return new THREE.LineCurve3(start, end); - }, [points]); + const positions = useMemo(() => points.map((p) => new THREE.Vector3(...p.position)), [points]); - return ( - - - - ); + return ; } -export default ReferenceLine; \ No newline at end of file +export default ReferenceLine; diff --git a/app/src/types/world/worldConstants.ts b/app/src/types/world/worldConstants.ts index b509ca2..7e00eff 100644 --- a/app/src/types/world/worldConstants.ts +++ b/app/src/types/world/worldConstants.ts @@ -127,6 +127,7 @@ export type PointConfig = { export type LineConfig = { tubularSegments: number; radius: number; + width: number; radialSegments: number; wallName: string; floorName: string; @@ -330,6 +331,7 @@ export const pointConfig: PointConfig = { export const lineConfig: LineConfig = { tubularSegments: 64, // Number of tubular segments radius: 0.15, // Radius of the lines + width: 20, // Width of the lines radialSegments: 8, // Number of radial segments wallName: "WallLine", // Name of the wall lines floorName: "FloorLine", // Name of the floor lines