upgrade to egui 0.22.0

This commit is contained in:
William Casarin
2023-07-06 11:20:25 -07:00
parent f7c1429dd0
commit 12dbdf6043
4 changed files with 800 additions and 632 deletions

1416
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,10 +12,10 @@ crate-type = ["lib", "cdylib"]
[dependencies] [dependencies]
#egui-android = { git = "https://github.com/jb55/egui-android.git" } #egui-android = { git = "https://github.com/jb55/egui-android.git" }
egui = "0.20.0" egui = "0.22.0"
eframe = { version = "0.20.0", features = [ "wgpu" ] } eframe = { version = "0.22.0", features = [ "wgpu" ] }
#eframe = "0.20.0" #eframe = "0.20.0"
egui_extras = { version = "0.20.0", features = ["image", "svg"] } egui_extras = { version = "0.22.0", features = ["image", "svg"] }
ehttp = "0.2.0" ehttp = "0.2.0"
image = { version = "0.24", features = ["jpeg", "png", "webp"] } image = { version = "0.24", features = ["jpeg", "png", "webp"] }
log = "0.4.17" log = "0.4.17"

View File

@@ -64,7 +64,7 @@ impl Default for Damus {
} }
pub fn is_mobile(ctx: &egui::Context) -> bool { pub fn is_mobile(ctx: &egui::Context) -> bool {
let screen_size = ctx.input().screen_rect().size(); let screen_size = ctx.screen_rect().size();
screen_size.x < 550.0 screen_size.x < 550.0
} }
@@ -388,7 +388,7 @@ fn set_app_style(ui: &mut egui::Ui) {
} }
fn render_damus_mobile(ctx: &egui::Context, app: &mut Damus) { fn render_damus_mobile(ctx: &egui::Context, app: &mut Damus) {
let panel_width = ctx.input().screen_rect.width(); let panel_width = ctx.screen_rect().width();
egui::CentralPanel::default().show(ctx, |ui| { egui::CentralPanel::default().show(ctx, |ui| {
set_app_style(ui); set_app_style(ui);
timeline_panel(ui, app, panel_width, 0); timeline_panel(ui, app, panel_width, 0);
@@ -398,7 +398,7 @@ fn render_damus_mobile(ctx: &egui::Context, app: &mut Damus) {
fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) { fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) {
render_panel(ctx, app); render_panel(ctx, app);
let screen_size = ctx.input().screen_rect.width(); let screen_size = ctx.screen_rect().width();
let calc_panel_width = (screen_size / app.n_panels as f32) - 30.0; let calc_panel_width = (screen_size / app.n_panels as f32) - 30.0;
let min_width = 300.0; let min_width = 300.0;
let need_scroll = calc_panel_width < min_width; let need_scroll = calc_panel_width < min_width;
@@ -409,7 +409,7 @@ fn render_damus_desktop(ctx: &egui::Context, app: &mut Damus) {
}; };
if app.n_panels == 1 { if app.n_panels == 1 {
let panel_width = ctx.input().screen_rect.width(); let panel_width = ctx.screen_rect().width();
egui::CentralPanel::default().show(ctx, |ui| { egui::CentralPanel::default().show(ctx, |ui| {
set_app_style(ui); set_app_style(ui);
timeline_panel(ui, app, panel_width, 0); timeline_panel(ui, app, panel_width, 0);

View File

@@ -14,7 +14,7 @@ async fn main() {
tracing_subscriber::fmt::init(); tracing_subscriber::fmt::init();
let native_options = eframe::NativeOptions::default(); let native_options = eframe::NativeOptions::default();
eframe::run_native( let _res = eframe::run_native(
"Damus Desktop", "Damus Desktop",
native_options, native_options,
Box::new(|_cc| Box::new(Damus::new())), Box::new(|_cc| Box::new(Damus::new())),