forked from 1b-agent/opencadstudio-upstream
fix(zoom): Zoom Extents fits full drawing on first use
The viewport context-menu item dispatched a bare "ZOOM" string, which no command branch handled, so it did nothing. Send "ZOOM EXTENTS" instead. fit_all() also fed on the frustum-culled wire set, so it only framed the entities already on screen — each invocation revealed a little more and the view converged on the true extent only after several uses (issue #51). It now builds an un-culled wire set at a fixed tessellation tolerance, so the bounds are zoom-independent and the first call fits the whole drawing. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
09e7e90aae
commit
e4668c66e7
2 files changed
+12
-2
No files matched your search
+1
-1
@@ -1458,7 +1458,7 @@ fn viewport_context_menu_overlay(
|
||||
items.push(item("Quick Select...".to_string(), Message::QSelectOpen));
|
||||
items.push(item(
|
||||
"Zoom Extents".to_string(),
|
||||
Message::Command("ZOOM".to_string()),
|
||||
Message::Command("ZOOM EXTENTS".to_string()),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -4948,7 +4948,17 @@ impl Scene {
|
||||
}
|
||||
|
||||
pub fn fit_all(&mut self) {
|
||||
let wires = self.entity_wires();
|
||||
// Use the FULL, un-culled wire set — not `entity_wires()`, which is
|
||||
// frustum-culled to the current view. Culled input would fit only the
|
||||
// entities already on screen, so each call would zoom out a little and
|
||||
// reveal more, converging on the true extent only after several uses
|
||||
// (issue #51). `wpp = None` also tessellates at a fixed tolerance so
|
||||
// the bounds don't drift with zoom-adaptive curve sampling.
|
||||
let layout_block = self.current_layout_block_handle();
|
||||
let mut wires = self.wires_for_block_culled(layout_block, None, None, None, None);
|
||||
if self.current_layout != "Model" {
|
||||
wires.extend(self.viewport_content_wires(layout_block, None, None));
|
||||
}
|
||||
if wires.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user