From 4d033cbd972ab8c8efdd3d2470437f45da5f2cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D0=BB=D0=B8=D0=BC=D0=BE=D0=B2=20=D0=A0=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BC?= Date: Sat, 10 Jan 2026 18:44:23 +0300 Subject: [PATCH] Fix build --- src/components/LayoutStep.tsx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/LayoutStep.tsx b/src/components/LayoutStep.tsx index 15730a7..7c5c2f8 100644 --- a/src/components/LayoutStep.tsx +++ b/src/components/LayoutStep.tsx @@ -1,4 +1,4 @@ -import React, { useRef, useState, useMemo, useEffect } from 'react'; +import React, { useRef, useState, useMemo } from 'react'; import { AppConfig, LayoutSplits, Partition } from '../types'; import { Grid, MousePointer2, Trash2, RotateCcw, X, Move, Settings2 } from 'lucide-react'; @@ -18,7 +18,6 @@ type DragTarget = export const LayoutStep: React.FC = ({ config, splits, onChange }) => { const svgRef = useRef(null); - const containerRef = useRef(null); const [mode, setMode] = useState('lines'); @@ -148,9 +147,7 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => { // --- HOVER LOGIC: MAIN LINES --- if (mode === 'lines') { setHoveredMainSplit(null); - const SNAP = 0.015; // Чувствительность - // Check hover existing - // (Logic handled in individual line elements via onMouseMove to simplify global handler) + const SNAP = 0.015; // Phantom Line if (nx > SNAP && nx < 1-SNAP && ny > SNAP && ny < 1-SNAP) { @@ -210,9 +207,7 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => { if (foundPart) { setHoveredPartition({ id: foundPart.id, cellKey: key }); } else { - // Show Phantom Partition based on movement direction logic - // If moving more horizontally -> vertical split. Moving vertically -> horizontal split. - // Simplified: Distance to edges + // Show Phantom Partition const distLeft = lx; const distRight = 1 - lx; const distTop = ly; const distBottom = 1 - ly; const minX = Math.min(distLeft, distRight); @@ -266,6 +261,13 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => { } }; + const handleMainSplitHover = (e: React.MouseEvent, axis: Axis, index: number) => { + if (mode !== 'lines' || dragging) return; + e.stopPropagation(); + setHoveredMainSplit({ axis, index }); + setPhantomMainAxis(null); + }; + return (
@@ -297,13 +299,13 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => { {mode === 'lines' ? (
ЛКМ: Создать/Тянуть линию - 2xЛКМ / ПКМ: Удалить + ПКМ: Удалить
) : (
ЛКМ в ячейке: Создать перегородку Драг: Двигать - 2xЛКМ: Удалить + ПКМ: Удалить
)}
@@ -312,7 +314,7 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => {
{/* SVG Container - FILLS SPACE BUT KEEPS ASPECT RATIO */} -
+
= ({ config, splits, onChange }) => { ref={svgRef} viewBox={`0 0 ${viewBoxW} ${viewBoxH}`} className="w-full h-full touch-none block" - preserveAspectRatio="none" // Важно: растягиваем SVG на весь div - onMouseMove={handleGlobalMouseMove} + preserveAspectRatio="none" + onMouseMove={handleMouseMove} onMouseDown={handleMouseDown} onMouseUp={() => setDragging(null)} onMouseLeave={() => setDragging(null)} @@ -399,7 +401,7 @@ export const LayoutStep: React.FC = ({ config, splits, onChange }) => { ); })} - {/* Фантомная перегородка (только если наведена мышь на ячейку и нет перегородки под курсором) */} + {/* Фантомная перегородка */} {isHovered && phantomPartition && !hoveredPartition && !dragging && ( {phantomPartition.axis === 'x' ? (