fix(viewport): show new paper-space viewport border without a zoom

Creating a viewport in a layout commits through document.add_entity_to_layout
+ Scene::auto_fit_viewport, both of which skip the geometry-cache bump that
Scene::add_entity performs for every other entity. So the new viewport's
border wasn't tessellated until the next zoom/pan happened to invalidate the
cache. Bump the wire tessellation (no-blocks: a viewport touches no block
definitions) right after the viewport is added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-25 18:55:20 +03:00
commit 244f951c00

View file

@ -687,6 +687,12 @@ impl OpenCADStudio {
{
Ok(new_handle) => {
self.tabs[i].scene.auto_fit_viewport(new_handle);
// Adding a viewport straight onto the document layout
// bypasses Scene::add_entity, which is what normally
// invalidates the wire-tessellation cache. Without this the
// new viewport's border isn't tessellated until the next
// zoom/pan forces a rebuild.
self.tabs[i].scene.bump_geometry_no_blocks();
Some(new_handle)
}
Err(e) => {