Phase 6: Auto-fit viewport and annotation scale hints
- Add model_space_extents() to Scene: collects key_vertices from all model-space entities to compute an AABB. - Add auto_fit_viewport() to Scene: sets view_target to model centroid and derives custom_scale / view_height so the content fits the new viewport with a 10% margin. - Call auto_fit_viewport() in commit_entity() after a viewport is added to a paper-space layout, so newly placed viewports immediately show model-space content at a sensible scale. - Scale line_weight_px by the viewport scale factor when projecting model-space wires into paper space, so dimension arrows and annotation lines appear at the correct visual thickness. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
403264d3ab
commit
ace83a0953
2 changed files with 67 additions and 1 deletions
|
|
@ -220,7 +220,10 @@ impl H7CAD {
|
|||
.document
|
||||
.add_entity_to_layout(entity, &layout)
|
||||
{
|
||||
Ok(_) => {}
|
||||
Ok(new_handle) => {
|
||||
// Auto-fit the new viewport to show model-space content.
|
||||
self.tabs[i].scene.auto_fit_viewport(new_handle);
|
||||
}
|
||||
Err(e) => self
|
||||
.command_line
|
||||
.push_error(&format!("Viewport could not be added: {e}")),
|
||||
|
|
|
|||
Loading…
Reference in a new issue