Fix issues found while integrating performance PRs

This commit is contained in:
Hakan Seven committed 2026-09-08 17:33:02 +03:00
1 parent 2b510c1a1e
commit 4972bbed70
6 files changed
+78 -213

No files matched your search

+14 -15
View File
@@ -265,13 +265,11 @@ impl OpenCADStudio {
self.control_observe_user_message(&msg);
let perf_started = crate::perf::enabled().then(Instant::now);
let perf_label = perf_message_label(&msg);
// Geometry epoch before dispatch. When it moves, this message drew or
// changed something, and the latency the user feels runs from here to
// the frame that shows it — not to the end of this handler. Stamping
// the nav-perf sample makes `nav-prepare` / `nav-render` report that
// span, the same way they already do for pan and zoom.
let perf_epoch_before = perf_started
.map(|_| self.tabs[self.active_tab].scene.geometry_epoch);
// Keep the stable tab id because dispatch may switch or close tabs.
let perf_edit_before = perf_started.map(|started| {
let tab = &self.tabs[self.active_tab];
(started, tab.id, tab.scene.geometry_epoch)
});
// A modal dialog must capture the keyboard the same way it already
// captures the mouse. Otherwise keystrokes from the global key
// subscription leak past the modal into the command line and fire as
@@ -331,14 +329,15 @@ impl OpenCADStudio {
self.otrack_active = None;
self.otrack_kind = None;
}
if let (Some(started), Some(before)) = (perf_started, perf_epoch_before) {
let tab = &self.tabs[self.active_tab];
if tab.scene.geometry_epoch != before {
tab.scene.record_nav_perf_caused(
crate::scene::NavPerfOp::Edit,
perf_label,
started,
);
if let Some((started, tab_id, before)) = perf_edit_before {
if let Some(tab) = self.tabs.iter().find(|tab| tab.id == tab_id) {
if tab.scene.geometry_epoch != before {
tab.scene.record_nav_perf_caused(
crate::scene::NavPerfOp::Edit,
perf_label,
started,
);
}
}
}
if let Some(started) = perf_started {