This commit is contained in:
Халимов Рустам
2026-01-11 22:38:12 +03:00
parent 918d9e0ea7
commit ade10e0aaf

View File

@@ -298,6 +298,16 @@ export const LayoutStep: React.FC<Props> = ({ config, splits, onChange }) => {
}
};
// --- ДОБАВЛЕНО: Очистка при выходе мыши ---
const handleMouseLeave = () => {
setDragging(null);
setPhantomMainAxis(null);
setHoveredMainSplit(null);
setHoveredCell(null);
setHoveredPartition(null);
setPhantomPartition(null);
};
// --- RENDER ---
const renderCellsAndPartitions = () => {
const elements = [];
@@ -430,7 +440,12 @@ export const LayoutStep: React.FC<Props> = ({ config, splits, onChange }) => {
<div className="flex-1 bg-slate-800/30 flex items-center justify-center p-4 overflow-hidden relative">
<div className="relative shadow-2xl bg-[#1e293b] border border-slate-600 rounded-sm overflow-hidden" style={{ width: aspectRatio > 1 ? 'auto' : '100%', height: aspectRatio > 1 ? '100%' : 'auto', aspectRatio: `${1/aspectRatio}`, maxHeight: '100%', maxWidth: '100%', cursor: mode === 'lines' ? (dragging ? 'grabbing' : hoveredMainSplit ? 'col-resize' : 'crosshair') : (dragging ? 'grabbing' : hoveredPartition ? 'grab' : hoveredCell ? 'crosshair' : 'default') }}>
<svg ref={svgRef} viewBox={`0 0 ${viewBoxW} ${viewBoxH}`} className="w-full h-full touch-none block" onMouseMove={handleMouseMove} onMouseDown={handleMouseDown} onMouseUp={() => setDragging(null)} onMouseLeave={() => setDragging(null)} onContextMenu={(e) => e.preventDefault()}>
<svg ref={svgRef} viewBox={`0 0 ${viewBoxW} ${viewBoxH}`} className="w-full h-full touch-none block"
onMouseMove={handleMouseMove}
onMouseDown={handleMouseDown}
onMouseUp={() => setDragging(null)}
onMouseLeave={handleMouseLeave} // ДОБАВЛЕН ОБРАБОТЧИК
onContextMenu={(e) => e.preventDefault()}>
<defs><pattern id="grid" width="50" height="50" patternUnits="userSpaceOnUse"><path d="M 50 0 L 0 0 0 50" fill="none" stroke="rgba(255,255,255,0.03)" strokeWidth="1"/></pattern></defs>
<rect width="100%" height="100%" fill="url(#grid)" />
{renderCellsAndPartitions()}