[66] Merge: Präsentationsplan mit einem Klick (site_and_shadow mit Massstab und Baurecht-Schalter)
This commit is contained in:
28 files changed
+1184
-39
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// [66] Präsentationsplan anlegen: Ops aus dem Kern-Fassadenteil (`plan/presentationSheet.ts`), angewendet
|
||||
// als EIN Undo-Schritt, Meldung über `notify`. Liefert die Id des neuen Blatts (zum Öffnen) oder `null`.
|
||||
|
||||
import { presentationSheetOps, type PresentationOptions } from "../core";
|
||||
import { t } from "../i18n";
|
||||
import { getState } from "./appStore";
|
||||
|
||||
export function createPresentationSheet(o: PresentationOptions): string | null {
|
||||
const st = getState();
|
||||
try {
|
||||
const format = `${o.paper.toUpperCase()} ${o.orientation === "landscape" ? t("layouts.landscape") : t("layouts.portrait")}`;
|
||||
const res = presentationSheetOps(
|
||||
st.project,
|
||||
o,
|
||||
{ sheetName: t("presentation.sheetName"), masterName: t("presentation.masterName", { format }), north: t("presentation.north") },
|
||||
String(Date.now()),
|
||||
);
|
||||
if (!res) {
|
||||
st.notify(t("presentation.empty"), "warning");
|
||||
return null;
|
||||
}
|
||||
st.applyChange(res.ops);
|
||||
if (res.plan.fits) st.notify(t("presentation.done", { scale: res.plan.scale, n: res.plan.items.length }), "info");
|
||||
else st.notify(t("presentation.tooBig", { scale: res.plan.scale }), "warning");
|
||||
return res.layoutId;
|
||||
} catch (e) {
|
||||
st.notify(`${t("presentation.failed")}: ${e instanceof Error ? e.message : String(e)}`, "error");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// [66] Modul-Hook: App registriert den Öffner des Präsentationsplan-Dialogs; Befehl `praesentation` und
|
||||
// der Knopf im Layouts-Panel rufen ihn auf, ohne an React/App gekoppelt zu sein (Muster `io/dxfImportHook`).
|
||||
|
||||
let opener: (() => void) | null = null;
|
||||
|
||||
/** App registriert hier den Öffner (oder hebt ihn beim Unmount auf). */
|
||||
export function setPresentationDialogOpener(fn: (() => void) | null): void {
|
||||
opener = fn;
|
||||
}
|
||||
|
||||
/** Öffnet den Dialog „Präsentationsplan", falls App ihn registriert hat. */
|
||||
export function openPresentationDialog(): void {
|
||||
opener?.();
|
||||
}
|
||||
Reference in new issue
Block a user