[89] Layout-Blatt: Zeichnen wie im Grundriss (Blatt-Ebene statt eigener Annotationen)
Jedes Layout hat eine Blatt-Ebene (DrawingLevel.layoutId, Papier 1:1 in Metern); ein offenes Blatt macht sie zur aktiven Ebene in derselben PlanView: gleiche Befehle, Fang, Griffe, Vorschau/HUD, Auswahl, Undo und dasselbe Rendering. Das Blatt liefert nur den Hintergrund (PlanView.backdrop) und das Platzieren der Viewports. Format 3 migriert Layout.annotations zu drawings2d. Layout-PDF legt die Blatt-Ebene über planToPrintSvg aufs Papier. Alter Annotations-Pfad gelöscht. e2e layoutSheet.spec.ts.
This commit is contained in:
43 files changed
+1245
-2756
No files matched your search
@@ -92,12 +92,22 @@ pub struct Ctx<'a> {
|
||||
pub floor_height: Option<f64>,
|
||||
pub cat: &'a str,
|
||||
pub wall_type: &'a str,
|
||||
/// Schrifthöhe neuer Texte (Modell-Meter, `textHeight` im Kontext): im Grundriss die Vorgabe
|
||||
/// [`DEFAULT_TEXT_HEIGHT`], auf einem Layout-Blatt (Papier 1:1) die Papierhöhe.
|
||||
pub text_height: f64,
|
||||
}
|
||||
|
||||
/// Schrifthöhe neuer Texte im Grundriss (Modell-Meter, 2.5 mm bei 1:100).
|
||||
pub const DEFAULT_TEXT_HEIGHT: f64 = 0.25;
|
||||
|
||||
fn text_height_of(c: &Value) -> f64 {
|
||||
opt_n(c, "textHeight").filter(|h| *h > 0.0 && h.is_finite()).unwrap_or(DEFAULT_TEXT_HEIGHT)
|
||||
}
|
||||
|
||||
pub(crate) fn ctx_of(v: &Value) -> Ctx<'_> {
|
||||
let c = v.get("ctx").unwrap_or(&Value::Null);
|
||||
let fh = opt_n(c, "floorHeight").filter(|h| *h > 0.0);
|
||||
Ctx { level: s_of(c, "level"), floor_height: fh, cat: s_of(c, "cat"), wall_type: s_of(c, "wallType") }
|
||||
Ctx { level: s_of(c, "level"), floor_height: fh, cat: s_of(c, "cat"), wall_type: s_of(c, "wallType"), text_height: text_height_of(c) }
|
||||
}
|
||||
|
||||
// ── Werte bauen ──────────────────────────────────────────────────────────────
|
||||
@@ -912,20 +922,22 @@ pub struct Req {
|
||||
floor_height: Option<f64>,
|
||||
cat: String,
|
||||
wall_type: String,
|
||||
text_height: f64,
|
||||
}
|
||||
|
||||
impl Req {
|
||||
pub fn new(v: Value) -> Req {
|
||||
let c = ctx_of(&v);
|
||||
let (level, floor_height, cat, wall_type) = (c.level.to_string(), c.floor_height, c.cat.to_string(), c.wall_type.to_string());
|
||||
Req { cmd: s_of(&v, "cmd").to_string(), v, level, floor_height, cat, wall_type }
|
||||
let text_height = c.text_height;
|
||||
Req { cmd: s_of(&v, "cmd").to_string(), v, level, floor_height, cat, wall_type, text_height }
|
||||
}
|
||||
}
|
||||
|
||||
/// Wie [`preview`] mit gelesener Anfrage (Mausschritt: dieselbe Anfrage, neue Punkte).
|
||||
pub fn preview_req(root: &Map<String, Value>, req: &Req, pts: &[f64]) -> Preview {
|
||||
let v = &req.v;
|
||||
let ctx = Ctx { level: &req.level, floor_height: req.floor_height, cat: &req.cat, wall_type: &req.wall_type };
|
||||
let ctx = Ctx { level: &req.level, floor_height: req.floor_height, cat: &req.cat, wall_type: &req.wall_type, text_height: req.text_height };
|
||||
let pts = flat_pts(pts);
|
||||
let mut p = Preview { ok: true, ..Default::default() };
|
||||
let out = &mut p.shapes;
|
||||
|
||||
Reference in new issue
Block a user