Add forward navigation animation
Also fix a few nav clipping bugs
From egui-nav:
William Casarin (5):
add forward nav support
fix body overlapping header
fix transition clipping when in a smaller container
fix forward nav clipping in small containers
fix background layer having the wrong UI id
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1108,7 +1108,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_nav"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/damus-io/egui-nav?rev=9f640df83494a79cd7aa0b5983c83290d284d6ee#9f640df83494a79cd7aa0b5983c83290d284d6ee"
|
||||
source = "git+https://github.com/damus-io/egui-nav?rev=cbe7c894fdc4bffe72b44240ce259388ecc571f7#cbe7c894fdc4bffe72b44240ce259388ecc571f7"
|
||||
dependencies = [
|
||||
"egui",
|
||||
"egui_extras",
|
||||
|
||||
@@ -32,7 +32,7 @@ eframe = { version = "0.27.2", default-features = false, features = [ "glow", "w
|
||||
egui_extras = { version = "0.27.2", features = ["all_loaders"] }
|
||||
ehttp = "0.2.0"
|
||||
egui_tabs = { git = "https://github.com/damus-io/egui-tabs", rev = "120971fc43db6ba0b6f194f4bd4a66f7e00a4e22" }
|
||||
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "9f640df83494a79cd7aa0b5983c83290d284d6ee" }
|
||||
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "ac22dfccbaa3d2fee57a8b0250bde11ebf4c5563" }
|
||||
reqwest = { version = "0.12.4", default-features = false, features = [ "rustls-tls-native-roots" ] }
|
||||
image = { version = "0.24", features = ["jpeg", "png", "webp"] }
|
||||
log = "0.4.17"
|
||||
|
||||
@@ -869,9 +869,13 @@ fn render_panel(ctx: &egui::Context, app: &mut Damus, timeline_ind: usize) {
|
||||
}
|
||||
|
||||
fn render_nav(routes: Vec<Route>, timeline_ind: usize, app: &mut Damus, ui: &mut egui::Ui) {
|
||||
let navigating = app.timelines[timeline_ind].navigating;
|
||||
let app_ctx = Rc::new(RefCell::new(app));
|
||||
|
||||
let nav_response = Nav::new(routes).show(ui, |ui, nav| match nav.top() {
|
||||
let nav_response =
|
||||
Nav::new(routes)
|
||||
.navigating(navigating)
|
||||
.show(ui, |ui, nav| match nav.top() {
|
||||
Route::Timeline(_n) => {
|
||||
timeline::timeline_view(ui, &mut app_ctx.borrow_mut(), timeline_ind);
|
||||
}
|
||||
@@ -920,6 +924,8 @@ fn render_nav(routes: Vec<Route>, timeline_ind: usize, app: &mut Damus, ui: &mut
|
||||
|
||||
if let Some(NavAction::Returned) = nav_response.action {
|
||||
app_ctx.borrow_mut().timelines[timeline_ind].routes.pop();
|
||||
} else if let Some(NavAction::Navigated) = nav_response.action {
|
||||
app_ctx.borrow_mut().timelines[timeline_ind].navigating = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ pub struct Timeline {
|
||||
pub views: Vec<TimelineView>,
|
||||
pub selected_view: i32,
|
||||
pub routes: Vec<Route>,
|
||||
pub navigating: bool,
|
||||
|
||||
/// Our nostrdb subscription
|
||||
pub subscription: Option<Subscription>,
|
||||
@@ -139,8 +140,10 @@ impl Timeline {
|
||||
let views = vec![notes, replies];
|
||||
let selected_view = 0;
|
||||
let routes = vec![Route::Timeline("Timeline".to_string())];
|
||||
let navigating = false;
|
||||
|
||||
Timeline {
|
||||
navigating,
|
||||
filter,
|
||||
views,
|
||||
subscription,
|
||||
@@ -309,9 +312,11 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
||||
debug!("bar action: {:?}", action);
|
||||
match action {
|
||||
BarAction::Reply => {
|
||||
app.timelines[timeline]
|
||||
let timeline = &mut app.timelines[timeline];
|
||||
timeline
|
||||
.routes
|
||||
.push(Route::Reply(NoteId::new(note.id().to_owned())));
|
||||
timeline.navigating = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user