forked from 1b-agent/opencadstudio-upstream
fix(tolerance): complete workflow integration
Sync current main and companion codec changes before preserving unsupported frame rows, rendering in the entity plane, and sharing final layout metrics with placement preview.
This commit is contained in:
1 parent
66bf4b1d5f
commit
81e7add1dd
65 files changed
+3708
-934
No files matched your search
@@ -1268,11 +1268,16 @@ impl OpenCADStudio {
|
||||
// ── Annotate commands ──────────────────────────────────────────
|
||||
"TEXT" => {
|
||||
use crate::modules::annotate::text::TextCommand;
|
||||
let height = crate::scene::creation_style::current_text_defaults(
|
||||
&self.tabs[i].scene.document,
|
||||
)
|
||||
.height;
|
||||
let new_cmd = TextCommand::with_height(height);
|
||||
let (defaults, styles, annotation_multiplier) = {
|
||||
let scene = &self.tabs[i].scene;
|
||||
let annotation_multiplier = scene.creation_annotation_multiplier();
|
||||
let defaults =
|
||||
crate::scene::creation_style::current_text_defaults(&scene.document);
|
||||
let styles = scene.document.text_styles.iter().cloned().collect();
|
||||
(defaults, styles, annotation_multiplier)
|
||||
};
|
||||
let new_cmd =
|
||||
TextCommand::with_defaults(defaults, styles, annotation_multiplier);
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
@@ -1307,7 +1312,13 @@ impl OpenCADStudio {
|
||||
&self.tabs[i].scene.document,
|
||||
)
|
||||
.height;
|
||||
let new_cmd = MTextCommand::with_height(height);
|
||||
let style = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.header
|
||||
.current_text_style_name
|
||||
.clone();
|
||||
let new_cmd = MTextCommand::with_defaults(height, style);
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
@@ -943,7 +943,12 @@ impl OpenCADStudio {
|
||||
|
||||
"ALIGN" => {
|
||||
use crate::modules::draw::modify::align::AlignCommand;
|
||||
let cmd = AlignCommand::new();
|
||||
|
||||
let selected: Vec<acadrust::Handle> =
|
||||
self.tabs[i].scene.selected.iter().copied().collect();
|
||||
|
||||
let cmd = AlignCommand::with_selection(selected);
|
||||
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
@@ -827,30 +827,8 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
// A viewport frames the model, so its framing is measured in model
|
||||
// units and has to follow them. Left alone, every layout would suddenly
|
||||
// look at a region a thousand times too large. The paper side of the
|
||||
// ratio is untouched — the sheet is still the same sheet — so the ratio
|
||||
// itself moves the other way.
|
||||
//
|
||||
// `transform_viewport` covers the rectangle and the target but not the
|
||||
// framing, so the framing is done here for every viewport, and the
|
||||
// target only for the ones the scale above did not already reach.
|
||||
// Not every viewport frames the model, though. Each layout's sheet
|
||||
// viewport frames the sheet — its view is the paper, measured in paper
|
||||
// units — so scaling it by the model's factor would leave the drawing
|
||||
// frame the same size as before while the view of it changed by a
|
||||
// thousand, which is the boundary appearing to break.
|
||||
let sheets: std::collections::HashSet<acadrust::Handle> = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.objects
|
||||
.values()
|
||||
.filter_map(|object| match object {
|
||||
acadrust::objects::ObjectType::Layout(layout) => Some(layout.viewport),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
// Model framing follows model units; sheet framing stays in paper units.
|
||||
let sheets = self.tabs[i].scene.sheet_viewport_handles();
|
||||
let scaled: std::collections::HashSet<acadrust::Handle> = handles.iter().copied().collect();
|
||||
let mut reframed = 0usize;
|
||||
for entity in self.tabs[i].scene.document.entities_mut() {
|
||||
@@ -858,14 +836,7 @@ impl OpenCADStudio {
|
||||
let acadrust::entities::EntityType::Viewport(vp) = entity else {
|
||||
continue;
|
||||
};
|
||||
// Only a paper-space viewport can be a sheet — the scale above
|
||||
// reached everything in model space, and what it reached frames the
|
||||
// model by definition. Among the rest, the layout names its sheet
|
||||
// outright, and a file that arrives without that link still gives
|
||||
// itself away by sitting at the paper origin, where only the sheet
|
||||
// sits.
|
||||
let is_sheet = !scaled.contains(&handle)
|
||||
&& (sheets.contains(&handle) || !crate::scene::Scene::is_content_viewport(vp));
|
||||
let is_sheet = !scaled.contains(&handle) && sheets.contains(&handle);
|
||||
if is_sheet {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user