From 74922b01ca79a85f8aa6f249cc663b2d32cc8c95 Mon Sep 17 00:00:00 2001 From: Exidex <16986685+Exidex@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:30:25 +0200 Subject: [PATCH] Hide action panel and settings download info popups when clicking on backdrop --- rust/client/src/ui/widget.rs | 10 +++++++++- rust/management_client/src/ui.rs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/rust/client/src/ui/widget.rs b/rust/client/src/ui/widget.rs index e7c2016..47f0679 100644 --- a/rust/client/src/ui/widget.rs +++ b/rust/client/src/ui/widget.rs @@ -7,7 +7,7 @@ use anyhow::anyhow; use iced::{Alignment, Font, Length}; use iced::alignment::Horizontal; use iced::font::Weight; -use iced::widget::{button, checkbox, column, container, horizontal_rule, horizontal_space, image, pick_list, row, scrollable, Space, text, text_input, tooltip, vertical_rule}; +use iced::widget::{button, checkbox, column, container, horizontal_rule, horizontal_space, image, pick_list, row, scrollable, Space, text, text_input, tooltip, vertical_rule, mouse_area}; use iced::widget::image::Handle; use iced::widget::tooltip::Position; use iced_aw::{floating_element, GridRow}; @@ -1333,6 +1333,14 @@ fn render_root<'a>( let content: Element<_> = column(vec![top_panel, top_separator, content, bottom_panel]) .into(); + let content = if hide_action_panel { + content + } else { + mouse_area(content) + .on_press(ComponentWidgetEvent::ToggleActionPanel { widget_id }) + .into() + }; + floating_element(content, action_panel_element) .offset(Offset::from([8.0, 40.0])) // TODO calculate based on theme .hide(hide_action_panel) diff --git a/rust/management_client/src/ui.rs b/rust/management_client/src/ui.rs index 5e9070f..a2641a8 100644 --- a/rust/management_client/src/ui.rs +++ b/rust/management_client/src/ui.rs @@ -3,7 +3,7 @@ use std::time::Duration; use iced::{Alignment, alignment, Application, color, Command, executor, font, futures, Length, Padding, Settings, Size, Subscription, time, window}; use iced::advanced::Widget; -use iced::widget::{button, column, container, horizontal_rule, horizontal_space, row, scrollable, text}; +use iced::widget::{button, column, container, horizontal_rule, horizontal_space, mouse_area, row, scrollable, text}; use iced_aw::{floating_element, Spinner}; use iced_aw::core::icons; use iced_aw::floating_element::{Anchor, Offset}; @@ -736,6 +736,14 @@ impl Application for ManagementAppModel { .into() }; + let content = if !self.download_info_shown { + content + } else { + mouse_area(content) + .on_press(ManagementAppMsg::ToggleDownloadInfo) + .into() + }; + floating_element(content, download_info_panel) .offset(Offset::from([8.0, 60.0])) .anchor(Anchor::NorthEast)