TMP: new egui-nav

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-09-28 20:04:53 -04:00
parent d81243f055
commit c4eccf0a8e
3 changed files with 29 additions and 16 deletions

3
Cargo.lock generated
View File

@@ -1555,8 +1555,9 @@ dependencies = [
[[package]]
name = "egui_nav"
version = "0.2.0"
source = "git+https://github.com/damus-io/egui-nav?rev=e4231c19dda9e6791d2f7b5cd610b8db5ff9a7f9#e4231c19dda9e6791d2f7b5cd610b8db5ff9a7f9"
source = "git+https://github.com/kernelkind/egui-nav?rev=41e389c77dff7df548299028684cd2ffc32d7987#41e389c77dff7df548299028684cd2ffc32d7987"
dependencies = [
"bitflags 2.9.1",
"egui",
"egui_extras",
]

View File

@@ -28,7 +28,7 @@ egui = { version = "0.31.1", features = ["serde"] }
egui-wgpu = "0.31.1"
egui_extras = { version = "0.31.1", features = ["all_loaders"] }
egui-winit = { version = "0.31.1", features = ["android-game-activity", "clipboard"] }
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "e4231c19dda9e6791d2f7b5cd610b8db5ff9a7f9" }
egui_nav = { git = "https://github.com/kernelkind/egui-nav", rev = "41e389c77dff7df548299028684cd2ffc32d7987" }
egui_tabs = { git = "https://github.com/damus-io/egui-tabs", rev = "6eb91740577b374a8a6658c09c9a4181299734d0" }
#egui_virtual_list = "0.6.0"
egui_virtual_list = { git = "https://github.com/jb55/hello_egui", rev = "a66b6794f5e707a2f4109633770e02b02fb722e1" }

View File

@@ -34,7 +34,9 @@ use crate::{
};
use egui::scroll_area::ScrollAreaOutput;
use egui_nav::{Nav, NavAction, NavResponse, NavUiType, Percent, PopupResponse, PopupSheet};
use egui_nav::{
Nav, NavAction, NavResponse, NavUiType, Percent, PopupResponse, PopupSheet, RouteResponse,
};
use enostr::ProfileState;
use nostrdb::{Filter, Ndb, Transaction};
use notedeck::{
@@ -1126,25 +1128,35 @@ pub fn render_nav(
.returning,
)
.show_mut(ui, |ui, render_type, nav| match render_type {
NavUiType::Title => NavTitle::new(
ctx.ndb,
ctx.img_cache,
get_active_columns_mut(ctx.i18n, ctx.accounts, &mut app.decks_cache),
nav.routes(),
col,
ctx.i18n,
)
.show_move_button(!narrow)
.show_delete_button(!narrow)
.show(ui),
NavUiType::Title => {
let action = NavTitle::new(
ctx.ndb,
ctx.img_cache,
get_active_columns_mut(ctx.i18n, ctx.accounts, &mut app.decks_cache),
nav.routes(),
col,
ctx.i18n,
)
.show_move_button(!narrow)
.show_delete_button(!narrow)
.show(ui);
RouteResponse {
response: action,
can_take_drag_from: Vec::new(),
}
}
NavUiType::Body => {
if let Some(top) = nav.routes().last() {
let resp = if let Some(top) = nav.routes().last() {
render_nav_body(ui, app, ctx, top, nav.routes().len(), col, inner_rect)
} else {
BodyResponse::none()
};
RouteResponse {
response: resp.output,
can_take_drag_from: resp.drag_id.map(|d| vec![d]).unwrap_or(Vec::new()),
}
.output
}
});