[144] Öffnungen verschieben (Zwischenstand): Kern opening_slide (Bogenwand, Überlappung, Dach-/Deckenöffnung), Hinweis aus Befehlen, Bemassung auf Bogen-Leibungen
This commit is contained in:
10 files changed
+603
-72
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user