added screenSpace for point
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DragControls } from "@react-three/drei";
|
||||
import { Box, DragControls, ScreenSizer } from "@react-three/drei";
|
||||
import * as Constants from "../../../types/world/worldConstants";
|
||||
|
||||
import BoxMaterial from "../wrappers/materials/boxMaterial";
|
||||
@@ -49,17 +49,18 @@ function Point({ point }: { readonly point: Point }) {
|
||||
<>
|
||||
{!isSelected ? (
|
||||
<DragControls axisLock="y" autoTransform={false} onDragStart={handleDragStart} onDrag={handleDrag} onDragEnd={handleDragEnd}>
|
||||
<mesh
|
||||
<ScreenSizer
|
||||
key={point.pointUuid}
|
||||
uuid={point.pointUuid}
|
||||
name={`${point.pointType}-Point`}
|
||||
scale={1}
|
||||
position={[...point.position]}
|
||||
onClick={handlePointClick}
|
||||
onPointerOver={handlePointerOver}
|
||||
onPointerOut={handlePointerOut}
|
||||
userData={point}
|
||||
>
|
||||
<boxGeometry args={boxScale} />
|
||||
<Box args={boxScale}>
|
||||
<BoxMaterial
|
||||
variant="box1"
|
||||
uOuterColor={colors.defaultOuterColor}
|
||||
@@ -68,7 +69,8 @@ function Point({ point }: { readonly point: Point }) {
|
||||
isHovered={isHovered}
|
||||
isDeleteHovered={isDeleteHovered}
|
||||
/>
|
||||
</mesh>
|
||||
</Box>
|
||||
</ScreenSizer>
|
||||
</DragControls>
|
||||
) : (
|
||||
<group
|
||||
|
||||
@@ -278,7 +278,14 @@ function MoveControls2D({ movedObjects, setMovedObjects, pastedObjects, setPaste
|
||||
type: "Aisle",
|
||||
lineData: {
|
||||
...updatedAisle,
|
||||
points: [initialStates[updatedAisle.points[0].pointUuid] ? { ...updatedAisle.points[0], position: initialStates[updatedAisle.points[0].pointUuid].position } : updatedAisle.points[0], initialStates[updatedAisle.points[1].pointUuid] ? { ...updatedAisle.points[1], position: initialStates[updatedAisle.points[1].pointUuid].position } : updatedAisle.points[1]] as [Point, Point],
|
||||
points: [
|
||||
initialStates[updatedAisle.points[0].pointUuid]
|
||||
? { ...updatedAisle.points[0], position: initialStates[updatedAisle.points[0].pointUuid].position }
|
||||
: updatedAisle.points[0],
|
||||
initialStates[updatedAisle.points[1].pointUuid]
|
||||
? { ...updatedAisle.points[1], position: initialStates[updatedAisle.points[1].pointUuid].position }
|
||||
: updatedAisle.points[1],
|
||||
] as [Point, Point],
|
||||
},
|
||||
newData: updatedAisle,
|
||||
timeStamp: new Date().toISOString(),
|
||||
@@ -330,7 +337,14 @@ function MoveControls2D({ movedObjects, setMovedObjects, pastedObjects, setPaste
|
||||
type: "Wall",
|
||||
lineData: {
|
||||
...updatedWall,
|
||||
points: [initialStates[updatedWall.points[0].pointUuid] ? { ...updatedWall.points[0], position: initialStates[updatedWall.points[0].pointUuid].position } : updatedWall.points[0], initialStates[updatedWall.points[1].pointUuid] ? { ...updatedWall.points[1], position: initialStates[updatedWall.points[1].pointUuid].position } : updatedWall.points[1]] as [Point, Point],
|
||||
points: [
|
||||
initialStates[updatedWall.points[0].pointUuid]
|
||||
? { ...updatedWall.points[0], position: initialStates[updatedWall.points[0].pointUuid].position }
|
||||
: updatedWall.points[0],
|
||||
initialStates[updatedWall.points[1].pointUuid]
|
||||
? { ...updatedWall.points[1], position: initialStates[updatedWall.points[1].pointUuid].position }
|
||||
: updatedWall.points[1],
|
||||
] as [Point, Point],
|
||||
},
|
||||
newData: updatedWall,
|
||||
timeStamp: new Date().toISOString(),
|
||||
|
||||
@@ -316,7 +316,7 @@ export const pointConfig: PointConfig = {
|
||||
defaultInnerColor: "#ffffff", // Default inner color of the points
|
||||
defaultOuterColor: "#ffffff", // Default outer color of the points
|
||||
deleteColor: "#ff0000", // Color of the points when deleting
|
||||
boxScale: [0.5, 0.5, 0.5], // Scale of the points
|
||||
boxScale: [20, 20, 20], // Scale of the points
|
||||
wallOuterColor: "#C7C7C7", // Outer color of the wall points
|
||||
floorOuterColor: "#808080", // Outer color of the floor points
|
||||
aisleOuterColor: "#FBBC05", // Outer color of the aisle points
|
||||
|
||||
Reference in New Issue
Block a user