cleanup dependencies

This commit is contained in:
Simon Gardling
2023-11-20 12:40:41 -05:00
parent 0087bcf431
commit ac3054354c
5 changed files with 50 additions and 43 deletions

View File

@@ -418,12 +418,10 @@ impl FunctionEntry {
);
}
if self.nth_derviative && let Some(ref nth_derviative) = self.nth_derivative_data {
plot_ui.line(
nth_derviative.clone()
.to_line()
.color(Color32::DARK_RED)
);
if self.nth_derviative
&& let Some(ref nth_derviative) = self.nth_derivative_data
{
plot_ui.line(nth_derviative.clone().to_line().color(Color32::DARK_RED));
}
// Plot integral data

View File

@@ -148,34 +148,41 @@ impl FunctionManager {
// Register movement and apply proper changes
function.autocomplete.register_movement(&movement);
if movement != Movement::Complete && let Some(hints) = function.autocomplete.hint.many() {
// Doesn't need to have a number in id as there should only be 1 autocomplete popup in the entire gui
if movement != Movement::Complete
&& let Some(hints) = function.autocomplete.hint.many()
{
// Doesn't need to have a number in id as there should only be 1 autocomplete popup in the entire gui
// hashed "autocomplete_popup"
const POPUP_ID: Id = create_id(7574801616484505465);
// hashed "autocomplete_popup"
const POPUP_ID: Id = create_id(7574801616484505465);
let mut clicked = false;
let mut clicked = false;
egui::popup_below_widget(ui, POPUP_ID, &re, |ui| {
hints.iter().enumerate().for_each(|(i, candidate)| {
if ui.selectable_label(i == function.autocomplete.i, *candidate).clicked() {
clicked = true;
function.autocomplete.i = i;
}
});
});
egui::popup_below_widget(ui, POPUP_ID, &re, |ui| {
hints.iter().enumerate().for_each(|(i, candidate)| {
if ui
.selectable_label(i == function.autocomplete.i, *candidate)
.clicked()
{
clicked = true;
function.autocomplete.i = i;
}
});
});
if clicked {
function.autocomplete.apply_hint(hints[function.autocomplete.i]);
if clicked {
function
.autocomplete
.apply_hint(hints[function.autocomplete.i]);
// Don't need this here as it simply won't be display next frame
// ui.memory_mut().close_popup();
// Don't need this here as it simply won't be display next frame
// ui.memory_mut().close_popup();
movement = Movement::Complete;
} else {
ui.memory_mut(|x| x.open_popup(POPUP_ID));
}
}
movement = Movement::Complete;
} else {
ui.memory_mut(|x| x.open_popup(POPUP_ID));
}
}
// Push cursor to end if needed
if movement == Movement::Complete {

View File

@@ -1,3 +1,4 @@
use crate::misc::Offset;
use egui::{Id, InnerResponse};
/// Creates an area ontop of a widget with an y offset