[144] Öffnungen verschieben (Zwischenstand): Kern opening_slide (Bogenwand, Überlappung, Dach-/Deckenöffnung), Hinweis aus Befehlen, Bemassung auf Bogen-Leibungen

This commit is contained in:
Claude committed 2026-11-06 07:31:40 +00:00
1 parent 35b628c5e7
commit 8d916a290c
10 files changed
+603 -72

No files matched your search

+6 -5
View File
@@ -458,20 +458,21 @@ export class ProjectDocument {
/**
* Befehl rechnen und anwenden ([K4] S3, `doc_cmd_commit`): wie {@link commitGrip} — ein Kern-Aufruf
* statt Ops hin (Rechnung) und zurück (Commit). Ergebnis: neues Projekt und die angewendeten Ops (leer
* = nichts zu tun, dann `project === base`) oder die Meldungen der Prüfung.
* = nichts zu tun, dann `project === base`), ein Hinweis-Schlüssel (i18n, z. B. [144] Öffnung an der
* Nachbaröffnung angehalten) oder die Meldungen der Prüfung.
*/
commitCmd(base: Project, req: object, coalesceKey: string | undefined, now: number): { project: Project; ops: CoreOp[] } | { problems: string[] } {
commitCmd(base: Project, req: object, coalesceKey: string | undefined, now: number): { project: Project; ops: CoreOp[]; notice?: string } | { problems: string[] } {
this.ensure(base);
if (!this.handle) return { problems: ["Projekt-Dokument im Kern nicht offen."] };
const out = core().doc_cmd_commit(this.handle, toMarkedJson(req), coalesceKey ?? "", now);
if (out.startsWith("\u0001")) throw new Error(out.slice(1));
const r = fromMarkedJson<{ ops: CoreOp[] } | { problems: string[] }>(out);
const r = fromMarkedJson<{ ops: CoreOp[]; notice?: string } | { problems: string[] }>(out);
if ("problems" in r) return r;
if (r.ops.length === 0) return { project: base, ops: r.ops };
if (r.ops.length === 0) return { project: base, ops: r.ops, notice: r.notice };
const extra = this.lastExtra();
const project = this.withExtra(applyOps(base, r.ops), extra);
this.setMirror(project);
return { project, ops: extra.length ? [...r.ops, ...extra] : r.ops };
return { project, ops: extra.length ? [...r.ops, ...extra] : r.ops, notice: r.notice };
}
/**
+16 -2
View File
@@ -522,7 +522,8 @@ export function createProjectSlice(
// Befehl ([K4] S3, `commands.rs`): der Kern rechnet ihn auf dem Dokument und wendet ihn im selben
// Aufruf an (`cmdMutation`); Prüfung, Verlauf und Meldungen wie `commitOps`.
const applyCmd = (req: object, coalesceKey?: string) =>
const applyCmd = (req: object, coalesceKey?: string) => {
let notice: string | undefined;
set((s) => {
const doc = storeDocument(s.project);
const cmd = (req as { cmd?: unknown }).cmd;
@@ -535,11 +536,14 @@ export function createProjectSlice(
queueMicrotask(() => get().notify(`${t("project.change.rejected")} ${problems[0]}`, "error"));
return {};
}
notice = res.notice;
if (res.ops.length === 0) return {};
opLog.push(res.ops);
if (opLog.length > OP_LOG_LIMIT) opLog.shift();
return { project: res.project, ...historyPatch(doc) };
});
noticeOnce(notice);
};
// Änderung direkt als Ops (ohne Differenz), s. `ProjectSlice.applyChange`.
const applyChange = (
@@ -547,6 +551,16 @@ export function createProjectSlice(
coalesceKey?: string,
) => set((s) => commitOps(s, typeof ops === "function" ? ops(s.project) : ops, coalesceKey));
// Hinweis aus dem Kern (i18n-Schlüssel) melden — derselbe höchstens alle 2 s (Griff-Zug: je Mausschritt).
let lastNotice = { key: "", at: 0 };
const noticeOnce = (notice: string | undefined) => {
if (!notice) return;
const now = Date.now();
if (notice === lastNotice.key && now - lastNotice.at < 2000) return;
lastNotice = { key: notice, at: now };
get().notify(t(notice as Parameters<typeof t>[0]), "warning");
};
// Griff-Änderung ([K4] S3): der Kern rechnet sie auf dem Dokument und wendet sie im selben Aufruf an
// (`grips.rs`, ein WASM-Aufruf je Mausschritt); Prüfung, Verlauf und Meldungen wie `commitOps`.
const applyGrip = (req: GripRequest, coalesceKey?: string) => {
@@ -566,7 +580,7 @@ export function createProjectSlice(
if (opLog.length > OP_LOG_LIMIT) opLog.shift();
return { project: res.project, ...historyPatch(doc) };
});
if (notice) get().notify(t(notice as Parameters<typeof t>[0]), "warning");
noticeOnce(notice);
};
return {