ui: optimize title panel
This commit is contained in:
parent
3e03f1a014
commit
6cfc6ae0b5
1 changed files with 14 additions and 18 deletions
|
@ -12,6 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use egui::Id;
|
||||||
use egui::style::Margin;
|
use egui::style::Margin;
|
||||||
use egui_extras::{Size, StripBuilder};
|
use egui_extras::{Size, StripBuilder};
|
||||||
|
|
||||||
|
@ -35,8 +36,9 @@ impl TitlePanel {
|
||||||
pub const DEFAULT_HEIGHT: f32 = 52.0;
|
pub const DEFAULT_HEIGHT: f32 = 52.0;
|
||||||
|
|
||||||
pub fn ui(title: String, l: Option<TitleAction>, r: Option<TitleAction>, ui: &mut egui::Ui) {
|
pub fn ui(title: String, l: Option<TitleAction>, r: Option<TitleAction>, ui: &mut egui::Ui) {
|
||||||
egui::TopBottomPanel::top("title_panel")
|
egui::TopBottomPanel::top(Id::from(title.clone()))
|
||||||
.resizable(false)
|
.resizable(false)
|
||||||
|
.exact_height(Self::DEFAULT_HEIGHT)
|
||||||
.frame(egui::Frame {
|
.frame(egui::Frame {
|
||||||
fill: Colors::YELLOW,
|
fill: Colors::YELLOW,
|
||||||
inner_margin: Margin::same(0.0),
|
inner_margin: Margin::same(0.0),
|
||||||
|
@ -46,10 +48,6 @@ impl TitlePanel {
|
||||||
})
|
})
|
||||||
.show_inside(ui, |ui| {
|
.show_inside(ui, |ui| {
|
||||||
StripBuilder::new(ui)
|
StripBuilder::new(ui)
|
||||||
.size(Size::exact(Self::DEFAULT_HEIGHT))
|
|
||||||
.vertical(|mut strip| {
|
|
||||||
strip.strip(|builder| {
|
|
||||||
builder
|
|
||||||
.size(Size::exact(Self::DEFAULT_HEIGHT))
|
.size(Size::exact(Self::DEFAULT_HEIGHT))
|
||||||
.size(Size::remainder())
|
.size(Size::remainder())
|
||||||
.size(Size::exact(Self::DEFAULT_HEIGHT))
|
.size(Size::exact(Self::DEFAULT_HEIGHT))
|
||||||
|
@ -65,8 +63,6 @@ impl TitlePanel {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_action(ui: &mut egui::Ui, action: Option<TitleAction>) {
|
fn draw_action(ui: &mut egui::Ui, action: Option<TitleAction>) {
|
||||||
|
|
Loading…
Reference in a new issue