[333] Layout: Blätter-Leiste mit Vorschau (wie die Seitenpalette in InDesign)

This commit is contained in:
Claude committed 2026-11-27 00:54:44 +00:00
1 parent 58ce7ebabb
commit 880d7751f9
8 files changed
+177 -2

No files matched your search

+1
View File
@@ -3862,6 +3862,7 @@ export const de = {
// Editor
"layouts.editorTitle": "Layout-Editor",
"layouts.fit": "Einpassen",
"layouts.strip": "Blätter",
"layouts.moveContent": "Inhalt im Rahmen verschieben",
"layouts.insert": "Einfügen",
"layouts.viewportShort": "Ansicht",
+1
View File
@@ -3849,6 +3849,7 @@ export const en: Record<TranslationKey, string> = {
// Editor
"layouts.editorTitle": "Layout editor",
"layouts.fit": "Fit",
"layouts.strip": "Sheets",
"layouts.moveContent": "Move content within the frame",
"layouts.insert": "Insert",
"layouts.viewportShort": "View",
+2
View File
@@ -91,6 +91,8 @@ export function useSheetPane(opts: {
const openId = () => activeLayout?.id ?? "";
const handlers = useEventBundle({
onBack: () => setActiveLayoutId(null),
// [333] Blätter-Leiste: anderes Blatt öffnen.
onOpenLayout: (id: string) => setActiveLayoutId(id),
// [208] Freier Text: Textspalte-Befehl auf der Blatt-Ebene (Rahmen aufziehen, dann tippen).
onAddText: () => runCommand?.("textbox"),
onPatchViewport: (viewportId: string, patch: Partial<Omit<LayoutViewport, "id" | "snapshotId">>) =>
+69
View File
@@ -8167,6 +8167,75 @@ body {
flex: 0 1 auto;
}
/* [333] Blätter-Leiste links neben dem Blatt (wie die Seitenpalette in InDesign). */
.layout-sheet-body {
display: flex;
flex: 1;
min-height: 0;
min-width: 0;
}
.sheet-strip {
flex: 0 0 124px;
overflow-y: auto;
padding: 10px 8px 16px;
display: flex;
flex-direction: column;
gap: 12px;
border-right: 1px solid var(--line, #2b2b2b);
background: var(--panel, #1d1d1d);
}
.sheet-strip-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
padding: 6px 4px;
border: 1px solid transparent;
border-radius: 6px;
background: transparent;
color: var(--ink);
cursor: pointer;
}
.sheet-strip-item:hover {
background: color-mix(in srgb, var(--ink, #ddd) 6%, transparent);
}
.sheet-strip-item.active {
border-color: var(--accent, #3b82f6);
background: color-mix(in srgb, var(--accent, #3b82f6) 10%, transparent);
}
.sheet-strip-item svg {
display: block;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.sheet-strip-vp {
fill: #e6e6e3;
stroke: #9a9a96;
stroke-width: 1px;
vector-effect: non-scaling-stroke;
}
.sheet-strip-tb {
fill: #f1f1ee;
stroke: #b5b5b0;
stroke-width: 1px;
vector-effect: non-scaling-stroke;
}
.sheet-strip-label {
display: flex;
gap: 4px;
max-width: 104px;
font-size: 11px;
line-height: 1.2;
}
.sheet-strip-no {
font-weight: 600;
flex: 0 0 auto;
}
.sheet-strip-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.layout-sheet-stage {
position: relative;
flex: 1;
+36
View File
@@ -30,6 +30,7 @@ import type {
import { createTable, PX_PER_M, sheetTables, storedChoice, TABLE_SOURCES, tableSourceLabel, viewportCombinationPatch, viewportSnapshotPlan } from "../core";
import type { TableOut } from "../core";
import { SheetTableHud } from "./SheetTableHud";
import { SheetStrip } from "./SheetStrip";
import { isInModalDialog } from "../state/modalScope";
import { SheetImageHud } from "./SheetImageHud";
import { SheetGuidesHud } from "./SheetGuidesHud";
@@ -287,6 +288,8 @@ function clip(s: string, max: number): string {
export interface LayoutSheetHandlers {
/** Zurück zur Modell-Ansicht (Grundriss/3D). */
onBack: () => void;
/** [333] Anderes Blatt der Mappe öffnen (Blätter-Leiste). */
onOpenLayout?: (layoutId: string) => void;
/** Freier Text ([208]): startet die Textspalte (Rahmen aufziehen, Text tippen) auf der Blatt-Ebene. */
onAddText?: () => void;
/** Ändert Position/Grösse/Massstab eines Viewports (mm). */
@@ -558,6 +561,24 @@ export function LayoutSheetPane({
window.addEventListener("pointercancel", up);
};
// [333] Blätter-Leiste (Vorschau aller Blätter), Zustand je Rechner gemerkt.
const [stripOpen, setStripOpen] = useState<boolean>(() => {
try {
return localStorage.getItem("dossier.sheetStrip") !== "0";
} catch {
return true;
}
});
const toggleStrip = () =>
setStripOpen((v) => {
try {
localStorage.setItem("dossier.sheetStrip", v ? "0" : "1");
} catch {
/* nur Komfort */
}
return !v;
});
// [333] Inhalts-Griff (wie InDesign): Inhalt im Rahmen verschieben, der Rahmen bleibt. Beim Loslassen wandert die Bildmitte.
const [contentPan, setContentPan] = useState<{ id: string; x: number; y: number } | null>(null);
const startContentPan = (e: ReactPointerEvent<SVGElement>, vp: LayoutViewport) => {
@@ -1186,6 +1207,18 @@ export function LayoutSheetPane({
<span className="material-symbols-outlined" aria-hidden="true">chevron_left</span>
<span className="tb-label">{t("layouts.backToModel")}</span>
</button>
{handlers.onOpenLayout && (
<button
className={`nav-add${stripOpen ? " active" : ""}`}
onClick={toggleStrip}
title={t("layouts.strip")}
aria-label={t("layouts.strip")}
aria-pressed={stripOpen}
data-sheet-strip-toggle
>
<span className="material-symbols-outlined" aria-hidden="true">view_sidebar</span>
</button>
)}
<span className="layout-sheet-name" title={layout.name}>{layout.name}</span>
<span className="layout-sheet-sep" aria-hidden="true" />
<span className="layout-sheet-group" role="group" aria-label={t("layouts.insert")}>
@@ -1284,6 +1317,8 @@ export function LayoutSheetPane({
</button>
</div>
<div className={`layout-sheet-body${stripOpen && handlers.onOpenLayout ? " with-strip" : ""}`}>
{stripOpen && handlers.onOpenLayout && <SheetStrip project={project} activeId={layout.id} onOpen={handlers.onOpenLayout} />}
<div className="layout-sheet-stage">
{children({ backdrop, fitBounds, onPlanSelect: onSheetSelect })}
@@ -1520,6 +1555,7 @@ export function LayoutSheetPane({
</div>
)}
</div>
</div>
</section>
);
}
+46
View File
@@ -0,0 +1,46 @@
// [333] Blätter-Leiste im Layout (wie die Seitenpalette in InDesign): alle Blätter der Mappe als kleine Vorschau — Papier im
// richtigen Seitenverhältnis, darauf die Rahmen der Ansichten und Tabellen —, Name und Plannummer darunter. Klick öffnet
// das Blatt. Die Vorschau ist schematisch (keine Plan-Erzeugung je Blatt: bleibt bei 30 Blättern sofort).
import type { Project } from "../model/types";
import { effectiveSheetSizeMm, findMaster } from "../model/layoutModel";
import { t } from "../i18n";
const THUMB_W = 96;
export function SheetStrip({ project, activeId, onOpen }: { project: Project; activeId: string; onOpen: (id: string) => void }) {
const layouts = project.layouts ?? [];
return (
<nav className="sheet-strip" aria-label={t("layouts.strip")} data-sheet-strip>
{layouts.map((l, i) => {
const size = effectiveSheetSizeMm(findMaster(project, l) ?? l);
const h = (THUMB_W * size.h) / Math.max(size.w, 1);
const label = l.planNumber || String(i + 1);
return (
<button
key={l.id}
type="button"
className={`sheet-strip-item${l.id === activeId ? " active" : ""}`}
title={l.name}
aria-current={l.id === activeId ? "page" : undefined}
onClick={() => l.id !== activeId && onOpen(l.id)}
>
<svg width={THUMB_W} height={h} viewBox={`0 0 ${size.w} ${size.h}`} aria-hidden="true">
<rect x={0} y={0} width={size.w} height={size.h} fill="#ffffff" />
{l.viewports.map((v) => (
<rect key={v.id} x={v.xMm} y={v.yMm} width={v.widthMm} height={v.heightMm} className="sheet-strip-vp" />
))}
{(l.tables ?? []).map((tb) => (
<rect key={tb.id} x={tb.xMm} y={tb.yMm} width={tb.widthMm} height={tb.heightMm ?? 20} className="sheet-strip-tb" />
))}
</svg>
<span className="sheet-strip-label">
<span className="sheet-strip-no">{label}</span>
<span className="sheet-strip-name">{l.name}</span>
</span>
</button>
);
})}
</nav>
);
}