forked from 1b-agent/opencadstudio-upstream
fix(web): capture save previews from the browser canvas
Capture the rendered canvas during the clean frame instead of requesting synchronous GPU buffer readback. Preserve embedded previews and allow saving when canvas readback is denied. Add a browser save and reopen regression check. Fixes #1021
This commit is contained in:
1 parent
a16e0f4163
commit
2ebad14586
4 files changed
+184
-13
No files matched your search
+8
-13
@@ -1704,19 +1704,14 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
let Some(pending) = self.pending_web_thumbnail_save.take() else {
|
||||
return Task::none();
|
||||
};
|
||||
iced::window::latest()
|
||||
.then(|window| match window {
|
||||
Some(window) => iced::window::screenshot(window).map(Some),
|
||||
None => Task::done(None),
|
||||
})
|
||||
.map(move |screenshot| Message::WebSaveScreenshot {
|
||||
tab_id: pending.tab_id,
|
||||
filename: pending.filename.clone(),
|
||||
ext: pending.ext.clone(),
|
||||
version: pending.version,
|
||||
bounds: Some(pending.bounds),
|
||||
screenshot,
|
||||
})
|
||||
Task::done(Message::WebSaveScreenshot {
|
||||
tab_id: pending.tab_id,
|
||||
filename: pending.filename,
|
||||
ext: pending.ext,
|
||||
version: pending.version,
|
||||
bounds: Some(pending.bounds),
|
||||
screenshot: crate::sys::capture_canvas(),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
Reference in new issue
Block a user