mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
M9: stop the side-by-side frame as soon as either half has closed (#3915)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3niW7kVeT8mi7TpWc8eAJ
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f945eff68a
commit
4ac31b3ffe
@@ -338,8 +338,10 @@ pub(crate) fn compare_area(app: &mut PdfCraftApp, old: usize, new: usize, ui: &m
|
||||
let ids = [app.views[old].id, app.views[new].id];
|
||||
let find = |app: &PdfCraftApp, id| app.views.iter().position(|v| v.id == id);
|
||||
ui.painter().vline(rect.min.x + half_w, rect.y_range(), egui::Stroke::new(gap, t.border));
|
||||
for (k, (r, id)) in [(left, ids[0]), (right, ids[1])].into_iter().enumerate() {
|
||||
let Some(index) = find(app, id) else { return };
|
||||
for (k, r) in [left, right].into_iter().enumerate() {
|
||||
// Both halves must still be open: once either has closed, the pair is over.
|
||||
let (Some(old_index), Some(new_index)) = (find(app, ids[0]), find(app, ids[1])) else { return };
|
||||
let index = if k == 0 { old_index } else { new_index };
|
||||
let caption = egui::Rect::from_min_size(r.min, egui::vec2(r.width(), caption_h));
|
||||
ui.painter().rect_filled(caption, 0.0, t.panel);
|
||||
let label = crate::i18n::fmt(if k == 0 { tl!("Old file: {name}") } else { tl!("New file: {name}") }, &[("name", &names[k])]);
|
||||
|
||||
Reference in New Issue
Block a user