From de53e867e9d3401312d8e76b3f4c07b3b8e9a41a Mon Sep 17 00:00:00 2001 From: ardocrat Date: Mon, 24 Jun 2024 12:56:00 +0300 Subject: [PATCH] ui: window stroke, fix tabs stroke, modal margin --- src/gui/views/modal.rs | 8 ++++---- src/gui/views/network/content.rs | 17 ++++++++++++++++- src/gui/views/wallets/content.rs | 18 ++++++++++++++++++ src/gui/views/wallets/wallet/content.rs | 14 ++++++++++++++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/gui/views/modal.rs b/src/gui/views/modal.rs index a149324..11bb792 100644 --- a/src/gui/views/modal.rs +++ b/src/gui/views/modal.rs @@ -43,7 +43,7 @@ pub struct Modal { impl Modal { /// Margin from [`Modal`] window at top/left/right. - const DEFAULT_MARGIN: f32 = 6.0; + const DEFAULT_MARGIN: f32 = 8.0; /// Maximum width of the content. const DEFAULT_WIDTH: f32 = Root::SIDE_PANEL_WIDTH - (2.0 * Self::DEFAULT_MARGIN); @@ -223,7 +223,7 @@ impl Modal { }; let x_align = View::get_left_inset() - View::get_right_inset(); let y_align = View::get_top_inset() + Self::DEFAULT_MARGIN + if View::is_desktop() { - Root::WINDOW_TITLE_HEIGHT + 8.0 + Root::WINDOW_TITLE_HEIGHT + Root::WINDOW_FRAME_MARGIN } else { 0.0 }; @@ -296,12 +296,12 @@ impl Modal { // Draw title content. let title_resp = ui.allocate_ui_at_rect(rect, |ui| { ui.vertical_centered_justified(|ui| { - ui.add_space(9.0); + ui.add_space(Self::DEFAULT_MARGIN); ui.label(RichText::new(self.title.as_ref().unwrap()) .size(19.0) .color(Colors::title(true)) ); - ui.add_space(8.0); + ui.add_space(Self::DEFAULT_MARGIN); }); }).response; diff --git a/src/gui/views/network/content.rs b/src/gui/views/network/content.rs index 4c00f62..f309c1e 100644 --- a/src/gui/views/network/content.rs +++ b/src/gui/views/network/content.rs @@ -45,6 +45,7 @@ impl Default for NetworkContent { impl NetworkContent { pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { let show_connections = AppConfig::show_connections_network_panel(); + let dual_panel = Root::is_dual_panel_mode(ui); // Show title panel. self.title_ui(ui, show_connections); @@ -61,6 +62,20 @@ impl NetworkContent { top: 6.0, bottom: View::get_bottom_inset() + 5.0, }, + outer_margin: if View::is_desktop() { + Margin { + left: -0.5, + right: if dual_panel { + 0.0 + } else { + -0.5 + }, + top: 0.0, + bottom: -0.5, + } + } else { + Margin::ZERO + }, ..Default::default() }) .show_inside(ui, |ui| { @@ -134,7 +149,7 @@ impl NetworkContent { .show(ui, |ui| { ui.add_space(1.0); ui.vertical_centered(|ui| { - let max_width = if !Root::is_dual_panel_mode(ui) { + let max_width = if !dual_panel { Root::SIDE_PANEL_WIDTH * 1.3 } else { ui.available_width() diff --git a/src/gui/views/wallets/content.rs b/src/gui/views/wallets/content.rs index 72cd959..70c4277 100644 --- a/src/gui/views/wallets/content.rs +++ b/src/gui/views/wallets/content.rs @@ -182,6 +182,24 @@ impl WalletsContent { top: 6.0, bottom: View::get_bottom_inset() + 5.0, }, + outer_margin: if View::is_desktop() { + Margin { + left: if !dual_panel { + -0.5 + } else { + 0.0 + }, + right: if !self.wallet_panel_opened() { + -0.5 + } else { + 0.0 + }, + top: 0.0, + bottom: -0.5, + } + } else { + Margin::ZERO + }, ..Default::default() }) .show_inside(ui, |ui| { diff --git a/src/gui/views/wallets/wallet/content.rs b/src/gui/views/wallets/wallet/content.rs index 3f5da69..4145869 100644 --- a/src/gui/views/wallets/wallet/content.rs +++ b/src/gui/views/wallets/wallet/content.rs @@ -133,6 +133,20 @@ impl WalletContent { top: 6.0, bottom: View::get_bottom_inset() + 5.0, }, + outer_margin: if View::is_desktop() { + Margin { + left: if dual_panel { + 0.0 + } else { + -0.5 + }, + right: -0.5, + top: 0.0, + bottom: -0.5, + } + } else { + Margin::ZERO + }, ..Default::default() }) .show_animated_inside(ui, !Self::block_navigation_on_sync(wallet), |ui| {