Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #5940: History panel: scroll to the current state on document change (#5909)

aiongge77799ab4f1d
diff --cc crates/ui-egui/src/panels.rs
index 78c4a65a4,46a0d4a66..00546cd76
--- a/crates/ui-egui/src/panels.rs
+++ b/crates/ui-egui/src/panels.rs
@@@ -3580,13 -3168,11 +3587,17 @@@ fn history(app: &mut PhotocraftApp, ui
ctx.data_mut(|d| d.remove::<SelectedSnapshot>(selected_snapshot_key(doc.id)));
}
}
+ if follow && let Some(rect) = current_rect {
+ ui.scroll_to_rect(rect, Some(egui::Align::BOTTOM));
+ }
+ ui.ctx().data_mut(|d| d.insert_temp(follow_id, revision));
});
+ if let Some(i) = set_source
+ && let Err(e) = app.run("history.setSource", json!({"state": i}))
+ {
+ app.ui.status = e;
+ app.ui.status_error = true;
+ }
if let Some(drag) = drag
&& let Some(p) = ctx.input(|i| i.pointer.interact_pos())
{