minor fixups
This commit is contained in:
parent
94258b4cb1
commit
5e5dd0f7a6
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -663,7 +663,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "eframe"
|
name = "eframe"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -683,7 +683,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui"
|
name = "egui"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"epaint",
|
"epaint",
|
||||||
@ -694,7 +694,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui-winit"
|
name = "egui-winit"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"egui",
|
"egui",
|
||||||
@ -707,7 +707,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui_glow"
|
name = "egui_glow"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -727,7 +727,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "emath"
|
name = "emath"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
@ -735,7 +735,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "epaint"
|
name = "epaint"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#9c285d1260d8b3b403fb59391b531bd684e06bd4"
|
source = "git+https://github.com/Titaniumtown/egui.git#f77c972b1405666b9f0250c44d7b488ac40e1f04"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ab_glyph",
|
"ab_glyph",
|
||||||
"ahash",
|
"ahash",
|
||||||
|
|||||||
@ -132,7 +132,7 @@ impl FunctionManager {
|
|||||||
Button::new_const(WidgetText::RichText(RichText::new_const(text))).frame(false)
|
Button::new_const(WidgetText::RichText(RichText::new_const(text))).frame(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the y offset multiplier of the `buttons_area` area
|
/// The y offset multiplier of the `buttons_area` area
|
||||||
const BUTTONS_Y_OFFSET: f32 = 1.32;
|
const BUTTONS_Y_OFFSET: f32 = 1.32;
|
||||||
|
|
||||||
widgets_ontop(
|
widgets_ontop(
|
||||||
@ -198,10 +198,7 @@ impl FunctionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn any_using_integral(&self) -> bool {
|
pub fn any_using_integral(&self) -> bool {
|
||||||
self.functions
|
self.functions.iter().any(|(_, func)| func.integral)
|
||||||
.iter()
|
|
||||||
.filter(|(_, func)| func.integral)
|
|
||||||
.count() > 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@ -107,7 +107,6 @@ pub struct MathApp {
|
|||||||
/// Contains the list of Areas calculated (the vector of f64) and time it took for the last frame (the Duration). Stored in a Tuple.
|
/// Contains the list of Areas calculated (the vector of f64) and time it took for the last frame (the Duration). Stored in a Tuple.
|
||||||
last_info: (Vec<Option<f64>>, Option<Duration>),
|
last_info: (Vec<Option<f64>>, Option<Duration>),
|
||||||
|
|
||||||
toggle_visuals: bool,
|
|
||||||
dark_mode: bool,
|
dark_mode: bool,
|
||||||
|
|
||||||
/// Stores opened windows/elements for later reference
|
/// Stores opened windows/elements for later reference
|
||||||
@ -256,7 +255,6 @@ impl MathApp {
|
|||||||
Self {
|
Self {
|
||||||
functions: Default::default(),
|
functions: Default::default(),
|
||||||
last_info: (vec![None], None),
|
last_info: (vec![None], None),
|
||||||
toggle_visuals: false,
|
|
||||||
dark_mode: true, // dark mode is default and is previously set
|
dark_mode: true, // dark mode is default and is previously set
|
||||||
text: text_data.expect("Didn't find text.json"),
|
text: text_data.expect("Didn't find text.json"),
|
||||||
opened: Opened::default(),
|
opened: Opened::default(),
|
||||||
@ -391,16 +389,6 @@ impl App for MathApp {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// Toggle visuals if requested
|
|
||||||
if self.toggle_visuals {
|
|
||||||
ctx.set_visuals(match self.dark_mode {
|
|
||||||
true => Visuals::light(),
|
|
||||||
false => Visuals::dark(),
|
|
||||||
});
|
|
||||||
self.dark_mode.bitxor_assign(true);
|
|
||||||
self.toggle_visuals = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If keyboard input isn't being grabbed, check for key combos
|
// If keyboard input isn't being grabbed, check for key combos
|
||||||
if !ctx.wants_keyboard_input() {
|
if !ctx.wants_keyboard_input() {
|
||||||
// If `H` key is pressed, toggle Side Panel
|
// If `H` key is pressed, toggle Side Panel
|
||||||
@ -455,7 +443,7 @@ impl App for MathApp {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Toggles dark/light mode
|
// Toggles dark/light mode
|
||||||
self.toggle_visuals = ui
|
if ui
|
||||||
.add(Button::new(match self.dark_mode {
|
.add(Button::new(match self.dark_mode {
|
||||||
true => "🌞",
|
true => "🌞",
|
||||||
false => "🌙",
|
false => "🌙",
|
||||||
@ -464,10 +452,17 @@ impl App for MathApp {
|
|||||||
true => "Turn the Lights on!",
|
true => "Turn the Lights on!",
|
||||||
false => "Turn the Lights off.",
|
false => "Turn the Lights off.",
|
||||||
})
|
})
|
||||||
.clicked();
|
.clicked()
|
||||||
|
{
|
||||||
|
ctx.set_visuals(match self.dark_mode {
|
||||||
|
true => Visuals::light(),
|
||||||
|
false => Visuals::dark(),
|
||||||
|
});
|
||||||
|
self.dark_mode.bitxor_assign(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Display Area and time of last frame
|
// Display Area and time of last frame
|
||||||
if self.last_info.0.iter().filter(|e| e.is_some()).count() > 0 {
|
if self.last_info.0.iter().any(|e| e.is_some()) {
|
||||||
ui.label(format!("Area: {}", option_vec_printer(&self.last_info.0)));
|
ui.label(format!("Area: {}", option_vec_printer(&self.last_info.0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user