[124] Kern: Zeichenbefehle lesen das Projekt typisiert (erste Charge)
commands::ops/cmd_create::ops/preview_req und cmd_solid::ops bekommen die typisierte Sicht (Document::project_lookup, cmdOps über queries::run_root_doc). Typisiert gelesen: Kategorie-Suche (has_category/category_or/category_color), aktiver Wandtyp, Wände des Geschosses für die Raumerkennung (floor_walls_flat), Raumzahl, erster Tür-/Fenstertyp. Betrifft Decke, Raum, Treppe, Öffnung, Dach, Dachfenster, Gaube; neue Elemente entstehen weiter als JSON.
This commit is contained in:
10 files changed
+142
-108
No files matched your search
@@ -19,7 +19,12 @@ fn run(h: u32, req: &Req, pts: &[f64]) -> Vec<f64> {
|
||||
if pts.len() % 2 != 0 {
|
||||
return Vec::new();
|
||||
}
|
||||
with_doc(h, |d| crate::cmd_create::preview_req(d.root(), req, pts).flat()).unwrap_or_default()
|
||||
with_doc(h, |d| {
|
||||
let (p, lk) = d.project_lookup().ok()?;
|
||||
Some(crate::cmd_create::preview_req(lk.root, p, req, pts).flat())
|
||||
})
|
||||
.flatten()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Vorschau eines Zeichenbefehls auf dem Dokument `h`: `[ok, nInfo, info…, Formen…]` (Formen wie
|
||||
|
||||
@@ -13,7 +13,11 @@ pub fn doc_cmd_commit(h: u32, req_json: &str, key: &str, now_ms: f64) -> String
|
||||
let key = (!key.is_empty()).then_some(key);
|
||||
let now = if now_ms.is_finite() { now_ms } else { 0.0 };
|
||||
let out = with_doc(h, |d| -> Result<String, String> {
|
||||
let res = crate::grips::GripResult { ops: crate::commands::ops(d.root(), req_json)?, notice: None };
|
||||
let ops = {
|
||||
let (p, lk) = d.project_lookup()?;
|
||||
crate::commands::ops(lk.root, p, req_json)?
|
||||
};
|
||||
let res = crate::grips::GripResult { ops, notice: None };
|
||||
let text = crate::grips::result_json(&res);
|
||||
if res.ops.is_empty() {
|
||||
return Ok(text);
|
||||
|
||||
@@ -254,7 +254,7 @@ pub fn doc_query_args(h: u32, name: &str, args: &[f64], text: &str) -> String {
|
||||
/// Abfrage auf der rohen Projekt-Wurzel (`crate::queries::run_root`); Fehler wie bei [`doc_query_args`].
|
||||
#[wasm_bindgen]
|
||||
pub fn doc_query_root(h: u32, name: &str, text: &str) -> String {
|
||||
let result = with_doc(h, |d| crate::queries::run_root(&d.lookup(), name, text)).unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
|
||||
let result = with_doc(h, |d| crate::queries::run_root_doc(d, name, text)).unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
|
||||
match result {
|
||||
Ok(json) => json,
|
||||
Err(e) => format!("\u{1}{e}"),
|
||||
|
||||
Reference in new issue
Block a user