import React, { useState, useMemo } from 'react';
import { Ruler, Scissors, Sparkles, MoveHorizontal, ArrowDownToLine, MoveVertical, Maximize2, FileText, ChevronRight, Printer } from 'lucide-react';
const App = () => {
// --- Состояние (State) ---
const [hips, setHips] = useState(102);
const [waist, setWaist] = useState(92);
const [sideHeight, setSideHeight] = useState(32);
const [seatHeight, setSeatHeight] = useState(25);
const [stretch, setStretch] = useState(10);
const [showMarkers, setShowMarkers] = useState(true);
// --- Вычисления (Logic) ---
const calculations = useMemo(() => {
const reductionFactor = 1 - (stretch / 100);
const totalWidthRaw = hips / 2;
const totalWidthReduced = totalWidthRaw * reductionFactor;
const backWidth = (totalWidthReduced * 0.45).toFixed(1);
const frontSideWidth = (totalWidthReduced * 0.25).toFixed(1);
const pouchWidth = (totalWidthReduced * 0.15).toFixed(1);
// Высоты
const pouchHeight = seatHeight;
const legLength = Math.max(0, sideHeight - seatHeight);
// Ластовица
const gussetWidth = (totalWidthReduced * 0.16).toFixed(1);
const gussetLength = (seatHeight * 0.5).toFixed(1);
const fabricLength = sideHeight + 5;
return {
backWidth,
frontSideWidth,
pouchWidth,
gussetWidth,
gussetLength,
fabricLength,
reductionFactor,
pouchHeight,
legLength
};
}, [hips, waist, sideHeight, seatHeight, stretch]);
// --- Печать ---
const handlePrint = () => {
window.print();
};
// --- Компоненты UI ---
const Marker = ({ x, y, label, color }) => {
if (!showMarkers) return null;
return (
{label}
);
};
const QuantityBadge = ({ x, y, count, note }) => (
x{count}
{note && {note}}
);
return (
{/* Стили для печати */}
{/* Header - Скрывается при печати */}
{/* Controls - Скрывается при печати */}
{/* Visualization & Table - ПЕЧАТНАЯ ЗОНА */}
{/* Top Bar */}
Техническая карта
Проект: Мужские боксеры (Анатомический крой)
{/* SVG Visualizer */}
{/* Data Table */}
Параметры кроя (см)
| 1. Спинка (ширина) | {calculations.backWidth} |
| 2. Бок (ширина) | {calculations.frontSideWidth} |
| 3. Гульфик (ширина) | {calculations.pouchWidth} |
| 4. Ластовица | {calculations.gussetWidth} x {calculations.gussetLength} |
Высоты (см)
| Высота сиденья (до ластовицы) | {calculations.pouchHeight} |
| Длина штанины | {calculations.legLength.toFixed(1)} |
| Общая длина бока | {sideHeight} |
| Расход ткани (при 150см) | ~{calculations.fabricLength} |
Точки совмещения: A-A', B-B', C-C', D-D', E-E' *Размеры даны без припусков на швы
);
};
export default App;