fix(control): capture after the next rendered frame

This commit is contained in:
ysdirector committed 2026-10-10 05:52:36 +08:00
1 parent 2a2d9b55d9
commit 7b210eac09
4 files changed
+129 -15

No files matched your search

+13
View File
@@ -2606,6 +2606,18 @@ impl OpenCADStudio {
} else {
Subscription::none()
};
// C11: park a `capture` request until the window draws another frame;
// a timer fallback prevents a request from hanging when no redraw is
// pending.
let capture_frame = if self.control.capture_frame_pending {
Subscription::batch([
window::frames().map(|_| Message::ControlCaptureFrame { redrew: true }),
iced::time::every(std::time::Duration::from_millis(50))
.map(|_| Message::ControlCaptureFrame { redrew: false }),
])
} else {
Subscription::none()
};
// Blink the MText preview caret while the editor is open.
let caret_blink = if self.mtext_editor.is_some() {
iced::time::every(std::time::Duration::from_millis(530))
@@ -2860,6 +2872,7 @@ impl OpenCADStudio {
nav_settle,
gpu_probe,
thumbnail_capture,
capture_frame,
caret_blink,
web_fonts,
autosave,