This commit is contained in:
Simon Gardling
2022-05-18 19:27:11 -04:00
parent 8ed749ef72
commit 99f134a52d
4 changed files with 74 additions and 68 deletions

View File

@@ -9,6 +9,7 @@
#![feature(const_option_ext)]
#![feature(const_slice_index)]
#![feature(slice_split_at_unchecked)]
#![feature(inline_const)]
#[macro_use]
extern crate static_assertions;

View File

@@ -9,6 +9,7 @@
#![feature(const_option_ext)]
#![feature(const_slice_index)]
#![feature(slice_split_at_unchecked)]
#![feature(inline_const)]
#[macro_use]
extern crate static_assertions;

View File

@@ -239,11 +239,11 @@ impl MathApp {
cc.egui_ctx.set_fonts(data.fonts);
// Set dark mode by default
cc.egui_ctx.set_visuals(crate::style::STYLE);
cc.egui_ctx.set_visuals(const { crate::style::dark() });
// Set spacing
let mut style: egui::Style = (*cc.egui_ctx.style()).clone();
style.spacing = crate::style::SPACING;
style.spacing = const { crate::style::spacing() };
cc.egui_ctx.set_style(style);
tracing::info!("Initialized! Took: {:?}", start.elapsed());
@@ -514,15 +514,19 @@ impl App for MathApp {
self.side_panel(ctx);
}
const EMPTY_FRAME: Frame = Frame {
// Central panel which contains the central plot (or an error created when parsing)
CentralPanel::default()
.frame(
const {
Frame {
inner_margin: Margin::symmetric(0.0, 0.0),
rounding: Rounding::none(),
fill: crate::style::STYLE.window_fill(),
..Frame::none()
};
// Central panel which contains the central plot (or an error created when parsing)
CentralPanel::default().frame(EMPTY_FRAME).show(ctx, |ui| {
}
},
)
.show(ctx, |ui| {
// Display an error if it exists
let errors_formatted: String = self
.functions
@@ -533,7 +537,9 @@ impl App for MathApp {
.filter(|(_, error)| error.is_some())
.map(|(i, error)| {
// use unwrap_unchecked as None Errors are already filtered out
unsafe { format!("(Function #{}) {}\n", i, error.as_ref().unwrap_unchecked()) }
unsafe {
format!("(Function #{}) {}\n", i, error.as_ref().unwrap_unchecked())
}
})
.collect::<String>();

View File

@@ -69,8 +69,6 @@ pub const fn dark() -> Visuals {
}
}
pub const SPACING: Spacing = spacing();
pub const fn spacing() -> Spacing {
Spacing {
item_spacing: vec2(8.0, 3.0),