Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
002947d
SHX fonts and big fonts for text, Hebrew SHX, non-zero glyph fill
claude Oct 27, 2026
20737a8
Hebrew names and text in reading order in the interface
claude Oct 27, 2026
de73d8c
Text formulas and fields: =... in text, dimensions and leaders; UPDAT…
claude Oct 27, 2026
ef9c473
Merge branch 'split/shx-fonts' into split/text-editor
claude Oct 27, 2026
76b1b16
In-place text editor for new and existing text, dimensions, leaders, …
claude Oct 27, 2026
124b7b4
HATCH: pick points near the view, boundary warnings, open-curve and b…
claude Oct 27, 2026
cd15b3e
Keep the hatch background helpers beside the other xdata applications
claude Oct 27, 2026
43087b5
Register the CADCRAFTFORMULA xdata application in the APPID table
claude Oct 27, 2026
cd10baa
Merge branch 'split/text-formulas' into split/text-editor
claude Oct 27, 2026
826e71f
Merge branch 'split/text-formulas' into split/hatch
claude Oct 27, 2026
e1804b7
Block Manager with previews, INSERT opens it; recent drawings as a gr…
claude Oct 27, 2026
70c1858
Same description of the folder picker in every part
claude Oct 27, 2026
57c1126
Merge branch 'split/text-editor' into split/blocks
claude Oct 27, 2026
40dbaf9
Merge branch 'split/hatch' into split/blocks
claude Oct 27, 2026
b5dbe44
Keep the module list sorted
claude Oct 27, 2026
1280841
SHX: big fonts bounded and not read by Unicode, no folder links follo…
claude Oct 27, 2026
8675424
Text formulas: review fixes
claude Oct 27, 2026
94466c2
Merge the text-formula and SHX review fixes
claude Oct 27, 2026
76bf204
In-place editor: review fixes
claude Oct 27, 2026
a59dfd1
Merge the text-formula review fixes
claude Oct 27, 2026
5af81ab
Hatch: review fixes
claude Oct 27, 2026
3bcfb17
Text formulas: ^ left to right; a replaced AutoCAD field is not writt…
claude Oct 27, 2026
dcd60dd
Merge the text-formula review fixes
claude Oct 27, 2026
064310a
In-place editor: an unchanged multiline text keeps its formula
claude Oct 27, 2026
670e041
Merge the text-formula review fixes
claude Oct 27, 2026
eba4e10
Double-click: an external reference named in other letter case is lef…
claude Oct 27, 2026
a1edba4
Merge the in-place editor and text-formula review fixes
claude Oct 27, 2026
91189c6
Merge the hatch review fixes
claude Oct 27, 2026
1093341
Blocks and Start page: review fixes
claude Oct 27, 2026
6616657
Custom patterns: the folder isn't read on every keystroke
claude Oct 27, 2026
ed237d7
Merge the review fixes of split/hatch
claude Oct 27, 2026
6c3e3c2
Merge upstream main (release 0.14.0)
claude Oct 28, 2026
f20306e
Merge upstream main (release 0.14.0)
claude Oct 28, 2026
e0f9985
Merge the text-formula part (with upstream main 0.14.0)
claude Oct 28, 2026
e79503c
Merge the SHX part (with upstream main 0.14.0)
claude Oct 28, 2026
3fa4ecf
Merge the text-formula part (with upstream main 0.14.0)
claude Oct 28, 2026
5986aa2
Merge the in-place editor part (with upstream main 0.14.0)
claude Oct 28, 2026
ba9bcce
Merge the hatch part (with upstream main 0.14.0)
claude Oct 28, 2026
ec32ad2
Keep DXF finishing within upstream's complexity limit
claude Oct 28, 2026
2fc041b
CLI perf drawing: the text formula field
claude Oct 28, 2026
3e517bb
Merge the review fixes of split/text-formulas
claude Oct 28, 2026
ca8f2b3
Merge the review fixes of split/text-formulas
claude Oct 28, 2026
b1e939d
Merge the review fixes of split/text-editor
claude Oct 28, 2026
d25e157
Merge the review fixes of split/hatch
claude Oct 28, 2026
a12a614
Session: the in-place editor's type after upstream's explicit imports
claude Oct 28, 2026
5f9d69d
In-place editor: within upstream's lint limits
claude Oct 28, 2026
aa8c500
fmt
claude Oct 28, 2026
6d144d8
Merge the review fixes of split/text-editor
claude Oct 28, 2026
f9d19c7
Merge the review fixes of split/hatch
claude Oct 28, 2026
002b1d4
fmt
claude Oct 28, 2026
d95b9d8
Block thumbnails: read_file takes a Path after upstream 0.14.0
claude Oct 28, 2026
5bffe09
Fonts: an unreadable user font file does not end the family search
claude Oct 31, 2026
0a45648
Merge upstream main (0.15.1) into the SHX font part
claude Oct 31, 2026
ae9e57f
Merge upstream main (0.15.1) into the text formula part
claude Oct 31, 2026
41645f6
Merge split/shx-fonts (with upstream main 0.15.1)
claude Oct 31, 2026
750e994
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
039a064
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
9ac8697
Fonts: SHX text sits a third of its height below a bottom alignment p…
claude Oct 31, 2026
98139c3
Text formulas: the formula field in upstream 0.15's new objects and r…
claude Oct 31, 2026
e2299cd
Merge split/shx-fonts (with upstream main 0.15.1)
claude Oct 31, 2026
8443f64
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
b8603b3
Merge split/text-formulas (with upstream main 0.15.1)
claude Oct 31, 2026
e003c16
Merge split/hatch (with upstream main 0.15.1)
claude Oct 31, 2026
d9f7f49
Merge split/text-editor (with upstream main 0.15.1)
claude Oct 31, 2026
90c9d06
Text formulas: an AutoCAD field the reader declines is kept on save
claude Oct 31, 2026
fded7c0
Hatch: a numeric background outside 0..=256 is refused
claude Oct 31, 2026
b01cc13
Block manager: as_chunks for the preview triangles (newer clippy)
claude Oct 31, 2026
780f469
Merge upstream main into split/text-formulas
claude Oct 31, 2026
08f2741
Merge split/text-formulas into split/text-editor
claude Oct 31, 2026
2b2879f
Merge split/text-formulas into split/hatch
claude Oct 31, 2026
cc51c22
Merge split/hatch into split/blocks
claude Oct 31, 2026
c8f2789
Merge split/text-editor into split/blocks
claude Oct 31, 2026
466fe69
Merge upstream main into split/text-formulas
claude Nov 2, 2026
5c965ba
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
f90bc00
Merge split/text-formulas into split/hatch
claude Nov 2, 2026
08f888b
Merge split/hatch into split/blocks
claude Nov 2, 2026
1ef98ef
Merge split/text-editor into split/blocks
claude Nov 2, 2026
ffa7310
Text formulas: Chinese labels for Text Formulas and Update Fields
claude Nov 2, 2026
eb87356
Fit upstream 0.15.1: the new fields in its added objects and tests
claude Nov 2, 2026
64adbbe
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
0eddb92
Text editor: Chinese labels for Edit Table Cells and Edit Text
claude Nov 2, 2026
bbf5631
Text editor: a dimension formula keeps its braces through the editor
claude Nov 2, 2026
72b6879
Merge split/text-editor into split/blocks
claude Nov 2, 2026
d4be4f5
Block thumbnails: the disk cache uses the same file version as memory
claude Nov 2, 2026
60709f6
Text formulas: an AutoCAD field's text is saved as read while the fie…
claude Nov 2, 2026
b444f5a
Merge split/text-formulas into split/text-editor
claude Nov 2, 2026
56da08c
Merge split/text-formulas into split/hatch
claude Nov 2, 2026
90f4e85
Merge split/hatch into split/blocks
claude Nov 2, 2026
9080eaa
Merge split/text-editor into split/blocks
claude Nov 2, 2026
5fe9571
Merge upstream main into split/text-formulas
claude Nov 4, 2026
cd81110
Merge split/shx-fonts (rebuilt on main with #1944) into split/text-ed…
claude Nov 4, 2026
fca338a
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
c96a06e
Merge split/text-formulas into split/hatch
claude Nov 4, 2026
86cf330
Merge split/text-editor into split/blocks
claude Nov 4, 2026
7212ab5
Merge split/hatch into split/blocks
claude Nov 4, 2026
1f6e3c8
Fonts: drop the old SHX reader, which #1944's crates/fonts/src/shx/ r…
claude Nov 4, 2026
b4b272b
Merge split/text-editor into split/blocks
claude Nov 4, 2026
3bf07c1
Fit main: the new fields in its added tests
claude Nov 4, 2026
748d920
Text formulas: a block reference's attribute formulas are worked out …
claude Nov 4, 2026
748888f
Tables: a formula typed with formatting in the in-place editor stays …
claude Nov 4, 2026
a85bb33
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
5836826
HATCH: a block reference's closed outline bounds a hatch picked by Se…
claude Nov 4, 2026
ddcb031
Merge split/text-formulas into split/hatch
claude Nov 4, 2026
35d956d
Text editor: fonts resolved as #1944 resolves them; SHX font changes …
claude Nov 4, 2026
c3c1ff5
Start page previews: a preview made while its file was saved again is…
claude Nov 4, 2026
c160885
Merge split/text-editor into split/blocks
claude Nov 4, 2026
1af169d
Merge split/hatch into split/blocks
claude Nov 4, 2026
2144528
Merge upstream main into split/text-formulas
claude Nov 4, 2026
f22ff80
Fit main: the new fields in its added code and tests
claude Nov 4, 2026
e8ecfee
Merge split/shx-fonts into split/text-editor
claude Nov 4, 2026
57d41d2
Merge split/text-formulas into split/text-editor
claude Nov 4, 2026
c86bca5
Fit main: the new fields in its added code and tests
claude Nov 4, 2026
fe50a54
Merge split/text-formulas into split/hatch
claude Nov 4, 2026
d8e4cd7
Merge split/hatch into split/blocks
claude Nov 4, 2026
5f7af3c
Merge split/text-editor into split/blocks
claude Nov 4, 2026
a14ae3c
Merge upstream main into split/shx-fonts
FredApps Nov 5, 2026
0c0d027
Merge upstream main into split/text-formulas
claude Nov 5, 2026
6b4c98d
Merge split/shx-fonts into split/text-editor
claude Nov 5, 2026
91b9212
Merge split/text-formulas into split/text-editor
claude Nov 5, 2026
90cb853
Merge split/text-formulas into split/hatch
claude Nov 5, 2026
225ed2b
Merge split/hatch into split/blocks
claude Nov 5, 2026
9cf9f2c
Merge split/text-editor into split/blocks
claude Nov 5, 2026
3829c8a
Merge upstream main into split/shx-fonts
claude Nov 13, 2026
420d851
Merge remote-tracking branch 'upstream/main' into split/text-formulas
claude Nov 13, 2026
682bf1d
Merge branch 'split/shx-fonts' into split/text-editor
claude Nov 13, 2026
970ee44
Merge branch 'split/text-formulas' into split/text-editor
claude Nov 13, 2026
1fe6131
Merge branch 'split/text-formulas' into split/hatch
claude Nov 13, 2026
8b3a569
Merge branch 'split/hatch' into split/blocks
claude Nov 13, 2026
5fef4ee
Merge split/text-editor into split/blocks
claude Nov 13, 2026
2cf6415
Fonts: a font without the diameter sign draws a stand-in it has
claude Nov 17, 2026
6107496
Merge upstream main into split/shx-fonts
claude Nov 17, 2026
57783dc
Merge upstream main into split/text-formulas
claude Nov 17, 2026
d8abe2b
Merge split/shx-fonts into split/text-editor
claude Nov 17, 2026
1f1478a
Merge split/text-formulas into split/text-editor
claude Nov 17, 2026
29472ae
Merge split/text-formulas into split/hatch
claude Nov 17, 2026
6ce113f
Merge split/hatch into split/blocks
claude Nov 17, 2026
b78899e
Merge split/text-editor into split/blocks
claude Nov 17, 2026
e62fba4
Block thumbnails: encode with the shared PNG writer main now has
claude Nov 17, 2026
95b0aa1
Merge upstream/main into split/shx-fonts
claude Nov 20, 2026
4c6774c
Merge upstream/main into split/text-formulas
claude Nov 20, 2026
7825737
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
aea1a77
Merge text-formulas into split/text-editor
claude Nov 20, 2026
2f5d3ad
Merge text-formulas into split/hatch
claude Nov 20, 2026
7c20bf5
Merge hatch into split/blocks: the Block Manager is its own panel bes…
claude Nov 20, 2026
8013eaa
Merge text-editor into split/blocks
claude Nov 20, 2026
c9adf4a
Merge main while retaining notices and both DXF dictionary helpers
FredApps Nov 20, 2026
49fe34d
Font lists name every installed font by its family, read from the fon…
claude Nov 20, 2026
9205745
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
f83af48
Read stacked text fields from main borrowed DXF sections
FredApps Nov 20, 2026
ba6d190
Text editor: the font list holds every installed font, and typing nar…
claude Nov 20, 2026
b16e209
Merge current main UCS modules and DXF write-back alongside stacked f…
FredApps Nov 20, 2026
52fa6ff
Initialize formula state in main multiline attribute fixture
FredApps Nov 20, 2026
9339c30
Classify stacked in-memory text commands for automation roots
FredApps Nov 20, 2026
dccc630
Clarify field update metadata without exempting parameter checks
FredApps Nov 20, 2026
f0fa8a5
Merge text-editor into split/blocks
claude Nov 20, 2026
93837ab
Merge FredApps's main merge and fixes (origin/split/blocks) into spli…
claude Nov 20, 2026
f90cf50
Merge upstream/main into split/shx-fonts
claude Nov 20, 2026
d48d599
Merge upstream/main into split/text-formulas (with FredApps's fixes f…
claude Nov 20, 2026
7210b1f
Merge shx-fonts into split/text-editor
claude Nov 20, 2026
2611352
Merge text-formulas into split/text-editor
claude Nov 20, 2026
2187800
Merge text-formulas into split/hatch
claude Nov 20, 2026
64a2d34
Hatch background: its APPID is written again after the merge
claude Nov 20, 2026
402a311
Merge split/hatch into split/blocks
claude Nov 20, 2026
42f7d37
Merge text-editor into split/blocks
claude Nov 20, 2026
ad91c71
Edit Text on a picked object is a drawing-only command for automation…
claude Nov 20, 2026
2e943c5
Table cell editing is a drawing-only command for automation roots
claude Nov 20, 2026
8aa15a8
Merge split/text-editor into split/blocks
claude Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/cadcraft-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ fn synthetic(n: usize, side: f64) -> Result<cadcraft_engine::doc::Drawing, Strin
plinegen: false,
}),
_ => EntityKind::Text(d::Text {
formula: None,
insert: v3(x, y),
align_pt: None,
height: s * 0.2,
Expand Down
1 change: 1 addition & 0 deletions apps/cadcraft/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ fn services() -> Services {
.save_file()
.map(|p| p.to_string_lossy().to_string())
})),
pick_folder: Some(Box::new(|| rfd::FileDialog::new().pick_folder().map(|p| p.to_string_lossy().to_string()))),
// APPLOAD: AutoLISP routines only, starting where the last one was loaded from.
pick_lisp: Some(Box::new(|dir: &str| {
let dialog = rfd::FileDialog::new().add_filter(i18n::t("AutoLISP (LSP)"), &["lsp"]).add_filter(i18n::t("All files"), &["*"]);
Expand Down
1 change: 1 addition & 0 deletions crates/constraints/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ fn invalid_references_and_purge() {
let t = add_e(
&mut d,
EntityKind::Text(cadcraft_doc::Text {
formula: None,
insert: v(0.0, 0.0),
align_pt: None,
height: 1.0,
Expand Down
4 changes: 4 additions & 0 deletions crates/doc/src/entity/dim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ pub struct DimMarks {
/// Inspection frame, label and rate (DIMINSPECT).
#[serde(skip_serializing_if = "Option::is_none")]
pub inspect: Option<Inspection>,
/// A formula for the dimension text (`=<>/2`, `=TEXT(<>,"0.0")&" mm"`; `<>` is the
/// measurement); `Dimension::text` holds the last result.
#[serde(skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

impl DimMarks {
Expand Down
8 changes: 8 additions & 0 deletions crates/doc/src/entity/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ pub struct Text {
pub halign: HAlign,
#[serde(default)]
pub valign: VAlign,
/// The formula the text shows the result of: `=...` (CADCraft text formulas) or an AutoCAD
/// field code (`%<\AcVar date \f "dd.MM.yyyy">%`). `value` holds the last result.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

impl Text {
Expand Down Expand Up @@ -83,6 +87,10 @@ pub struct MText {
/// one column.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub columns: Option<MTextColumns>,
/// The formula the text shows the result of (see [`Text::formula`]); `contents` holds the
/// last result.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub formula: Option<String>,
}

fn attach_tl() -> u8 {
Expand Down
2 changes: 2 additions & 0 deletions crates/doc/src/extents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ mod tests {

fn text(halign: HAlign, valign: VAlign) -> Text {
Text {
formula: None,
insert: Vec3::new(0.0, 0.0, 0.0),
align_pt: Some(Vec3::new(0.0, 0.0, 0.0)),
height: 1.0,
Expand Down Expand Up @@ -346,6 +347,7 @@ mod tests {
#[test]
fn multileader_text_is_inside_its_bounds() {
let mtext = crate::MText {
formula: None,
insert: Vec3::new(25.45, 0.0, 0.0),
height: 5.0,
width: 0.0,
Expand Down
29 changes: 29 additions & 0 deletions crates/doc/src/tables/tablebreak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,25 @@ impl Table {
b
}

/// The top-left corner, width and height of cell (`row`, `col`) — over its merged span — in
/// the part that holds the row.
pub fn cell_rect(&self, row: usize, col: usize) -> Option<(Vec2, f64, f64)> {
if col >= self.col_widths.len() || row >= self.row_heights.len() {
return None;
}
let (rs, cs) =
self.cells.get(row).and_then(|r| r.get(col)).and_then(|c| c.merged).map_or((1, 1), |(a, b)| (a.max(1) as usize, b.max(1) as usize));
let x: f64 = self.col_widths.iter().take(col).map(|w| size(*w)).sum();
let w: f64 = self.col_widths.iter().skip(col).take(cs).map(|w| size(*w)).sum();
for part in self.parts() {
let Some(at) = part.rows.iter().position(|r| *r == row) else { continue };
let y: f64 = part.rows.iter().take(at).map(|r| size(self.row_heights.get(*r).copied().unwrap_or(0.0))).sum();
let h: f64 = part.rows.iter().skip(at).take(rs).map(|r| size(self.row_heights.get(*r).copied().unwrap_or(0.0))).sum();
return Some((part.origin + Vec2::new(x, -y), w, h));
}
None
}

/// The cell (row, col) under `p`, in any part.
pub fn cell_at_point(&self, p: Vec2) -> Option<(usize, usize)> {
for part in self.parts() {
Expand Down Expand Up @@ -216,6 +235,16 @@ mod tests {
}
}

#[test]
fn cell_rect_covers_the_merged_span_and_hostile_indices_are_none() {
let mut t = table(3);
assert_eq!(t.cell_rect(1, 1), Some((Vec2::new(2.0, -1.0), 3.0, 1.0)));
t.cells[0][0].merged = Some((1, 2));
assert_eq!(t.cell_rect(0, 0), Some((Vec2::ZERO, 5.0, 1.0)));
assert_eq!(t.cell_rect(9, 0), None);
assert_eq!(t.cell_rect(0, usize::MAX), None);
}

#[test]
fn unbroken_is_one_part() {
let t = table(5);
Expand Down
4 changes: 4 additions & 0 deletions crates/doc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn visible_attributes_of_a_missing_block_still_count() {
let attrib = |invisible: bool| Attrib {
tag: "TAG".into(),
text: Text {
formula: None,
insert: Vec3::new(1000.0, 1000.0, 0.0),
align_pt: None,
height: 10.0,
Expand Down Expand Up @@ -441,6 +442,7 @@ fn attdef_in_block_is_ignored_in_insert_extents() {
EntityKind::AttDef(Attrib {
tag: "TAG".into(),
text: Text {
formula: None,
insert: Vec3::new(5000.0, 5000.0, 0.0),
align_pt: None,
height: 1.0,
Expand All @@ -466,6 +468,7 @@ fn attdef_in_block_is_ignored_in_insert_extents() {

fn text_kind(value: &str) -> EntityKind {
EntityKind::Text(Text {
formula: None,
insert: Vec3::new(10.0, 10.0, 0.0),
align_pt: None,
height: 2.0,
Expand All @@ -481,6 +484,7 @@ fn text_kind(value: &str) -> EntityKind {

fn mtext_kind(contents: &str) -> EntityKind {
EntityKind::MText(MText {
formula: None,
insert: Vec3::new(10.0, 10.0, 0.0),
height: 2.0,
width: 0.0,
Expand Down
51 changes: 41 additions & 10 deletions crates/engine/src/cmd/annotate/mleader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fn mleader_kind(s: &Session, pts: &[Vec2], text: &str, landing: bool) -> Option<
landing: v3(*landing_pt),
dogleg,
text: (!text.is_empty()).then(|| MText {
formula: None,
insert: v3(tpos),
height: th,
width: 0.0,
Expand Down Expand Up @@ -66,6 +67,7 @@ pub(super) fn run_leader(s: &mut Session, p: &Value) -> Result<Value> {
let th = s.doc()?.dim_style(&style(s)).map(|d| d.text_height).unwrap_or(0.18);
out.push(
s.add_entity(EntityKind::MText(MText {
formula: None,
insert: v3(*last + Vec2::new(th * 0.5, th * 0.5)),
height: th,
width: 0.0,
Expand Down Expand Up @@ -119,6 +121,8 @@ pub(super) struct MLeaderM {
block: bool,
block_name: String,
block_center: bool,
/// The in-place editor's box while the text is asked for.
editor: Option<MText>,
}

impl MLeaderM {
Expand All @@ -141,8 +145,21 @@ impl MLeaderM {
block: o.block && s.doc().is_ok_and(|d| d.block(&s.last_used.mleader_block).is_some()),
block_name: s.last_used.mleader_block.clone(),
block_center: o.block_center,
editor: None,
}
}
/// Where the text goes while it is asked for: next to the landing, as the multileader will
/// place it.
fn refresh_editor(&mut self, s: &Session) {
self.editor = if self.wants_text() && self.opt.is_none() {
mleader_kind(s, &self.leader(None), "X", self.landing).and_then(|k| match k {
EntityKind::MLeader(m) => m.text.map(|t| MText { contents: String::new(), ..t }),
_ => None,
})
} else {
None
};
}
/// Keep the order and Options for the next MLEADER.
fn remember(&self, s: &mut Session) {
s.last_used.mleader = MLeaderOptions {
Expand Down Expand Up @@ -342,6 +359,30 @@ impl Interactive for MLeaderM {
}
}
fn input(&mut self, s: &mut Session, i: Input) -> Result<Step> {
let step = self.answer(s, i);
self.refresh_editor(s);
step
}
fn editing_mtext(&self) -> Option<MText> {
self.editor.clone()
}
fn preview(&self, s: &Session, c: Vec2) -> Vec<EntityKind> {
if self.opt.is_some() || self.wants_text() || self.leader_done || self.pts.is_empty() {
return Vec::new();
}
let text = self.text.as_deref().unwrap_or("");
let next = self.constrained(c);
let shape = mleader_kind(s, &self.leader(Some(next)), text, self.landing)
.and_then(|k| crate::cmd::mleader_content::apply(s, k, &self.content_spec()).ok());
// The segment being placed, drawn as well in case the multileader preview hides it.
let mut out = vec![EntityKind::Line(cadcraft_doc::Line { a: v3(*self.pts.last().unwrap_or(&next)), b: v3(next) })];
out.extend(shape);
out
}
}

impl MLeaderM {
fn answer(&mut self, s: &mut Session, i: Input) -> Result<Step> {
if let Some(o) = self.opt {
self.opt = self.option(s, o, i);
self.remember(s);
Expand Down Expand Up @@ -376,14 +417,4 @@ impl Interactive for MLeaderM {
}
if self.leader_done && !self.wants_text() { self.finish(s) } else { Ok(Step::Continue) }
}
fn preview(&self, s: &Session, c: Vec2) -> Vec<EntityKind> {
if self.opt.is_some() || self.wants_text() || self.leader_done || self.pts.is_empty() {
return Vec::new();
}
let text = self.text.as_deref().unwrap_or("");
mleader_kind(s, &self.leader(Some(self.constrained(c))), text, self.landing)
.and_then(|k| crate::cmd::mleader_content::apply(s, k, &self.content_spec()).ok())
.into_iter()
.collect()
}
}
1 change: 1 addition & 0 deletions crates/engine/src/cmd/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ fn attdef_kind(s: &Session, tag: &str, prompt: &str, default: &str, at: Vec2, he
EntityKind::AttDef(Attrib {
tag: tag.to_ascii_uppercase(),
text: Text {
formula: None,
insert: v3(at),
align_pt: None,
height,
Expand Down
Loading