Hold back files that are ready to open while an opened document's Missing Fonts dialog waits for the frame

This commit is contained in:
bflatastic
2026-11-22 20:29:37 +07:00
parent 09020aa53c
commit 7e444041bb
2 changed files with 6 additions and 1 deletions
@@ -352,6 +352,11 @@ fn after_open_for(app: &mut VectorcraftApp, r: &Value, web: bool) {
}
}
/// Whether an opened document's Missing Fonts dialog waits for the frame's pump to open it.
pub(crate) fn waiting(app: &VectorcraftApp) -> bool {
app.ui.pending_fonts.iter().any(|&uid| dialog_for(app, uid).is_some())
}
/// The Missing Fonts dialog of the open document `uid`, when fonts it uses aren't available.
fn dialog_for(app: &VectorcraftApp, uid: u64) -> Option<MissingFontsDialog> {
let st = app.session.documents().iter().find(|d| d.uid == uid)?;
+1 -1
View File
@@ -142,7 +142,7 @@ fn track(app: &mut VectorcraftApp, path: &str, done: Receiver<Result<ReadFile, S
/// May the active document change now ([`poll`])?
pub(crate) fn may_switch(app: &VectorcraftApp) -> bool {
let s = &app.session;
!(app.any_dialog_open() || s.in_interaction() || (s.tool_busy() && s.pointer_held()))
!(app.any_dialog_open() || crate::dialogs::missing_fonts::waiting(app) || s.in_interaction() || (s.tool_busy() && s.pointer_held()))
}
/// Open the files that are ready (each frame). Not while a dialog is open: a document that opens