- CAD 싣기 곁값 bare — 제목줄 · 리본 · 패널 · 상태막대 안 그림 · 높이 변수 0 - 모달 [확정 풀기] 지움 · 확정 배지 · [CAD 에서 열기] 그대로 · M02 미리보기 그대로 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
78 lines
3.2 KiB
TypeScript
78 lines
3.2 KiB
TypeScript
/**
|
|
* CAD 화면 골격 조립 — 제목표시줄 · 리본 · 좌측 팔레트 · 탐색막대 · 명령행 · 상태막대.
|
|
* 각 조각은 자기 파일에 있고, 여기서는 배치와 표시 상태만 다룬다.
|
|
*/
|
|
import { type FC, useEffect, useState } from 'react';
|
|
import { CommandLine } from './CommandLine';
|
|
import { InspectorPanel } from './InspectorPanel';
|
|
import { QuickProperties } from './QuickProperties';
|
|
import { BlockLibraryPanel } from './BlockLibraryPanel';
|
|
import { LayersWidget, PropertiesWidget, TextStyleWidget } from './RibbonWidgets';
|
|
import { QuickAccessBar } from './QuickAccessBar';
|
|
import { Ribbon } from '../ribbon/Ribbon';
|
|
import { StatusBar } from './StatusBar';
|
|
import { useCadRefresh } from './use-cad-refresh';
|
|
import { isInspectorCollapsed, isRibbonCollapsed, setInspectorCollapsed } from './ui-state';
|
|
import { getActiveToolActor, isBare } from '../state';
|
|
import type { Tool } from '../tools';
|
|
import { ViewControls } from './ViewControls';
|
|
import { DropHint } from './DropHint';
|
|
|
|
export const Toolbar: FC = () => {
|
|
useCadRefresh();
|
|
const [commandLineVisible, setCommandLineVisible] = useState(false);
|
|
|
|
const activeTool = (getActiveToolActor()?.getSnapshot()?.context?.type ?? null) as Tool | null;
|
|
const ribbonCollapsed = isRibbonCollapsed();
|
|
// 좌측 패널 접힘 — 호스트(M02 미리보기)가 접힌 채로 실을 수 있게 ui-state 에 둔다
|
|
const panelCollapsed = isInspectorCollapsed();
|
|
// 캔버스만(B07 평면도 관리 모달) — 겉칸을 안 그리고 높이 · 폭 변수를 0 으로
|
|
const bare = isBare();
|
|
|
|
useEffect(() => {
|
|
// 편 상태의 폭은 App.css의 `--cad-panel-width` 기본값을 쓴다. 여기 숫자를 박아
|
|
// 두면 스타일에서 넓혀도 이 인라인 값이 덮는다(2026-09-01 실측: 300px 무시됨).
|
|
if (panelCollapsed || bare) document.documentElement.style.setProperty('--cad-panel-width', '0px');
|
|
else document.documentElement.style.removeProperty('--cad-panel-width');
|
|
document.documentElement.style.setProperty(
|
|
'--cad-command-height',
|
|
commandLineVisible && !bare ? '86px' : '0px'
|
|
);
|
|
// 리본 접힘 — 탭 줄(26px)만 남기고 패널 줄 자리를 걷는다(`Ribbon.tsx` 가 안 그림).
|
|
if (bare) document.documentElement.style.setProperty('--cad-ribbon-height', '0px');
|
|
else if (ribbonCollapsed)
|
|
document.documentElement.style.setProperty('--cad-ribbon-height', '26px');
|
|
else document.documentElement.style.removeProperty('--cad-ribbon-height');
|
|
window.dispatchEvent(new Event('resize'));
|
|
}, [panelCollapsed, commandLineVisible, ribbonCollapsed, bare]);
|
|
|
|
if (bare) return null;
|
|
|
|
return (
|
|
<>
|
|
<QuickAccessBar />
|
|
<Ribbon
|
|
activeTool={activeTool}
|
|
widgets={{
|
|
properties: <PropertiesWidget />,
|
|
layers: <LayersWidget />,
|
|
textStyle: <TextStyleWidget />,
|
|
}}
|
|
/>
|
|
<InspectorPanel
|
|
collapsed={panelCollapsed}
|
|
onToggleCollapsed={() => setInspectorCollapsed(!panelCollapsed)}
|
|
/>
|
|
<ViewControls />
|
|
<DropHint />
|
|
<QuickProperties />
|
|
<BlockLibraryPanel />
|
|
{commandLineVisible && <CommandLine />}
|
|
<StatusBar
|
|
commandLineVisible={commandLineVisible}
|
|
onToggleCommandLine={() => setCommandLineVisible((value) => !value)}
|
|
/>
|
|
</>
|
|
);
|
|
};
|