= ({ config, splits, onChange }) => {
>
@@ -393,24 +419,35 @@ export const LayoutStep: React.FC
= ({ config, splits, onChange }) => {
- Настройки стенки
+ Настройки стенки
+
-
Выделите стенку для настройки.
Двойной клик удаляет её.
+
+ Выделите стенку для настройки.
Двойной клик удаляет её.
+
)}
diff --git a/src/services/geometryGenerator.ts b/src/services/geometryGenerator.ts
index 8aa57b9..584d6ac 100644
--- a/src/services/geometryGenerator.ts
+++ b/src/services/geometryGenerator.ts
@@ -4,11 +4,9 @@ import { AppConfig, LayoutSplits, GeneratedPart, Partition } from '../types';
export const calculateParts = (config: AppConfig, splits: LayoutSplits): GeneratedPart[] => {
const parts: GeneratedPart[] = [];
-
- // ЗАЩИТА ОТ ОШИБОК ДАННЫХ
const safeX = Array.isArray(splits?.x) ? splits.x : [];
const safeY = Array.isArray(splits?.y) ? splits.y : [];
- const safePartitions = splits?.partitions || {};
+ const safeParts = splits?.partitions || {};
const xPoints = [0, ...[...safeX].sort((a, b) => a - b), 1];
const yPoints = [0, ...[...safeY].sort((a, b) => a - b), 1];
@@ -17,16 +15,13 @@ export const calculateParts = (config: AppConfig, splits: LayoutSplits): Generat
for (let i = 0; i < xPoints.length - 1; i++) {
for (let j = 0; j < yPoints.length - 1; j++) {
-
const rawX = xPoints[i] * config.drawer.width;
const rawY = yPoints[j] * config.drawer.depth;
const rawW = (xPoints[i + 1] - xPoints[i]) * config.drawer.width;
const rawD = (yPoints[j + 1] - yPoints[j]) * config.drawer.depth;
- // Получаем перегородки
- const internalPartitions = safePartitions[`${i}-${j}`] || [];
+ const internalPartitions = safeParts[`${i}-${j}`] || [];
- // Допуски
const realWidth = rawW - config.printerTolerance;
const realDepth = rawD - config.printerTolerance;
const realX = rawX + (config.printerTolerance / 2);
@@ -51,8 +46,6 @@ export const calculateParts = (config: AppConfig, splits: LayoutSplits): Generat
return parts;
};
-// ... Вспомогательные функции (createBinGeometry, exportSTL) ...
-// (Они остаются без изменений из прошлого ответа, там всё верно)
const createRoundedRectShape = (width: number, height: number, radius: number): THREE.Shape => {
const shape = new THREE.Shape();
const x = -width / 2;
diff --git a/src/types.ts b/src/types.ts
index 5a2422b..caff0da 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -11,11 +11,10 @@ export interface AppConfig {
cornerRadius: number;
}
-// Описание внутренней перегородки
export interface Partition {
id: string;
axis: 'x' | 'y';
- offset: number; // 0.1 - 0.9
+ offset: number; // 0.0 - 1.0
height: number;
rounded: boolean;
}
@@ -23,7 +22,7 @@ export interface Partition {
export interface LayoutSplits {
x: number[];
y: number[];
- // Ключ: "i-j", Значение: массив перегородок
+ // Ключ "i-j", Значение - массив перегородок
partitions: Record
;
}