bug fix on shortcuts and polygon
This commit is contained in:
@@ -17,16 +17,16 @@ function Floor2DInstance({ floor }: { readonly floor: Floor }) {
|
|||||||
|
|
||||||
const centroid: [number, number, number] = useMemo(() => {
|
const centroid: [number, number, number] = useMemo(() => {
|
||||||
const center = getCenteroidPoint(points2D);
|
const center = getCenteroidPoint(points2D);
|
||||||
if (!center) return [0, Constants.floorConfig.height + 0.01, 0];
|
if (!center) return [0, Constants.floorConfig.height, 0];
|
||||||
|
|
||||||
return [center.x, Constants.floorConfig.height + 0.01, center.y] as [number, number, number];
|
return [center.x, Constants.floorConfig.height, center.y] as [number, number, number];
|
||||||
}, [points2D]);
|
}, [points2D]);
|
||||||
|
|
||||||
const formattedArea = `${area.toFixed(2)} m²`;
|
const formattedArea = `${area.toFixed(2)} m²`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExtrudePolygon castShadow receiveShadow name={`Floor-2D-${floor.floorUuid}`} points={floor.points} options={{ depth: 0, bevelEnabled: false }} userData={floor}>
|
<ExtrudePolygon castShadow receiveShadow name={`Floor-2D-${floor.floorUuid}`} position={[0, 0.05, 0]} points={floor.points} options={{ depth: 0, bevelEnabled: false }} userData={floor}>
|
||||||
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.floorColor : Constants.lineConfig.floorColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.floorColor : Constants.lineConfig.floorColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
||||||
</ExtrudePolygon>
|
</ExtrudePolygon>
|
||||||
|
|
||||||
|
|||||||
@@ -154,16 +154,16 @@ function Floor2D({ room }: { readonly room: Point[] }) {
|
|||||||
|
|
||||||
const centroid: [number, number, number] = useMemo(() => {
|
const centroid: [number, number, number] = useMemo(() => {
|
||||||
const center = getCenteroidPoint(points2D);
|
const center = getCenteroidPoint(points2D);
|
||||||
if (!center) return [0, Constants.floorConfig.height + 0.01, 0];
|
if (!center) return [0, Constants.floorConfig.height, 0];
|
||||||
|
|
||||||
return [center.x, Constants.floorConfig.height + 0.01, center.y] as [number, number, number];
|
return [center.x, Constants.floorConfig.height, center.y] as [number, number, number];
|
||||||
}, [points2D]);
|
}, [points2D]);
|
||||||
|
|
||||||
const formattedArea = `${area.toFixed(2)} m²`;
|
const formattedArea = `${area.toFixed(2)} m²`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExtrudePolygon points={room} receiveShadow castShadow name="Wall-Floor" options={{ depth: 0, bevelEnabled: false }}>
|
<ExtrudePolygon points={room} receiveShadow castShadow name="Wall-Floor" position={[0, 0.05, 0]} options={{ depth: 0, bevelEnabled: false }}>
|
||||||
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.wallColor : Constants.lineConfig.wallColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.wallColor : Constants.lineConfig.wallColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
||||||
</ExtrudePolygon>
|
</ExtrudePolygon>
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,16 @@ function Zone2DInstance({ zone }: { readonly zone: Zone }) {
|
|||||||
|
|
||||||
const centroid: [number, number, number] = useMemo(() => {
|
const centroid: [number, number, number] = useMemo(() => {
|
||||||
const center = getCenteroid(points2D);
|
const center = getCenteroid(points2D);
|
||||||
if (!center) return [0, Constants.floorConfig.height + 0.01, 0];
|
if (!center) return [0, Constants.floorConfig.height, 0];
|
||||||
|
|
||||||
return [center.x, Constants.floorConfig.height + 0.01, center.y] as [number, number, number];
|
return [center.x, Constants.floorConfig.height, center.y] as [number, number, number];
|
||||||
}, [points2D]);
|
}, [points2D]);
|
||||||
|
|
||||||
const formattedArea = `${area.toFixed(2)} m²`;
|
const formattedArea = `${area.toFixed(2)} m²`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExtrudePolygon points={zone.points} options={{ depth: 0, bevelEnabled: false }} castShadow receiveShadow name={`Zone-2D-${zone.zoneUuid}`} userData={zone}>
|
<ExtrudePolygon points={zone.points} options={{ depth: 0, bevelEnabled: false }} position={[0, 0.05, 0]} castShadow receiveShadow name={`Zone-2D-${zone.zoneUuid}`} userData={zone}>
|
||||||
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.zoneColor : Constants.lineConfig.zoneColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
<meshBasicMaterial color={savedTheme === "dark" ? Constants.lineConfig.zoneColor : Constants.lineConfig.zoneColor} side={DoubleSide} transparent opacity={0.4} depthWrite={false} />
|
||||||
</ExtrudePolygon>
|
</ExtrudePolygon>
|
||||||
|
|
||||||
|
|||||||
@@ -96,13 +96,13 @@ const KeyPressListener: React.FC = () => {
|
|||||||
// These should only apply in 2D view
|
// These should only apply in 2D view
|
||||||
const twoDToolConfigs: Record<string, { tool: string; mode: string }> = {
|
const twoDToolConfigs: Record<string, { tool: string; mode: string }> = {
|
||||||
Q: { tool: "draw-wall", mode: "Wall" },
|
Q: { tool: "draw-wall", mode: "Wall" },
|
||||||
"6": { tool: "draw-wall", mode: "Wall" },
|
// "6": { tool: "draw-wall", mode: "Wall" },
|
||||||
R: { tool: "draw-aisle", mode: "Aisle" },
|
R: { tool: "draw-aisle", mode: "Aisle" },
|
||||||
"7": { tool: "draw-aisle", mode: "Aisle" },
|
// "7": { tool: "draw-aisle", mode: "Aisle" },
|
||||||
E: { tool: "draw-zone", mode: "Zone" },
|
E: { tool: "draw-zone", mode: "Zone" },
|
||||||
"8": { tool: "draw-zone", mode: "Zone" },
|
// "8": { tool: "draw-zone", mode: "Zone" },
|
||||||
T: { tool: "draw-floor", mode: "Floor" },
|
T: { tool: "draw-floor", mode: "Floor" },
|
||||||
"9": { tool: "draw-floor", mode: "Floor" },
|
// "9": { tool: "draw-floor", mode: "Floor" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = twoDToolConfigs[key];
|
const config = twoDToolConfigs[key];
|
||||||
|
|||||||
Reference in New Issue
Block a user