fixup and remove egui legend
This commit is contained in:
parent
8cca3b03dc
commit
40424719cb
1
TODO.md
1
TODO.md
@ -7,7 +7,6 @@
|
|||||||
- Prevent user from making too many function entries
|
- Prevent user from making too many function entries
|
||||||
- Display function errors as tooltips or a warning box (not preventing the display of the graph)
|
- Display function errors as tooltips or a warning box (not preventing the display of the graph)
|
||||||
- Clone functions
|
- Clone functions
|
||||||
- Better integration with egui's legend
|
|
||||||
2. Smart display of graph
|
2. Smart display of graph
|
||||||
- Display of intersections between functions
|
- Display of intersections between functions
|
||||||
3. Allow constants in min/max integral input (like pi or euler's number)
|
3. Allow constants in min/max integral input (like pi or euler's number)
|
||||||
|
|||||||
@ -378,10 +378,6 @@ impl FunctionEntry {
|
|||||||
.collect();
|
.collect();
|
||||||
debug_assert_eq!(data.len(), settings.plot_width + 1);
|
debug_assert_eq!(data.len(), settings.plot_width + 1);
|
||||||
self.derivative_data = data;
|
self.derivative_data = data;
|
||||||
|
|
||||||
unsafe {
|
|
||||||
assume(!self.derivative_data.is_empty());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.nth_derviative && self.nth_derivative_data.is_none() {
|
if self.nth_derviative && self.nth_derivative_data.is_none() {
|
||||||
@ -390,10 +386,6 @@ impl FunctionEntry {
|
|||||||
.collect();
|
.collect();
|
||||||
debug_assert_eq!(data.len(), settings.plot_width + 1);
|
debug_assert_eq!(data.len(), settings.plot_width + 1);
|
||||||
self.nth_derivative_data = Some(data);
|
self.nth_derivative_data = Some(data);
|
||||||
|
|
||||||
unsafe {
|
|
||||||
assume(self.nth_derivative_data.is_some());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,9 +399,6 @@ impl FunctionEntry {
|
|||||||
);
|
);
|
||||||
self.integral_data =
|
self.integral_data =
|
||||||
Some((data.iter().map(|(x, y)| Bar::new(*x, *y)).collect(), area));
|
Some((data.iter().map(|(x, y)| Bar::new(*x, *y)).collect(), area));
|
||||||
unsafe {
|
|
||||||
assume(self.integral_data.is_some());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.invalidate_integral();
|
self.invalidate_integral();
|
||||||
|
|||||||
@ -566,17 +566,13 @@ impl App for MathApp {
|
|||||||
|
|
||||||
let available_width: usize = (ui.available_width() as usize) + 1; // Used in later logic
|
let available_width: usize = (ui.available_width() as usize) + 1; // Used in later logic
|
||||||
let width_changed = available_width != self.settings.plot_width;
|
let width_changed = available_width != self.settings.plot_width;
|
||||||
|
self.settings.plot_width = available_width;
|
||||||
if width_changed {
|
|
||||||
self.settings.plot_width = available_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create and setup plot
|
// Create and setup plot
|
||||||
Plot::new("plot")
|
Plot::new("plot")
|
||||||
.set_margin_fraction(Vec2::ZERO)
|
.set_margin_fraction(Vec2::ZERO)
|
||||||
.data_aspect(1.0)
|
.data_aspect(1.0)
|
||||||
.include_y(0)
|
.include_y(0)
|
||||||
.legend(egui::plot::Legend::default())
|
|
||||||
.show(ui, |plot_ui| {
|
.show(ui, |plot_ui| {
|
||||||
let bounds = plot_ui.plot_bounds();
|
let bounds = plot_ui.plot_bounds();
|
||||||
let min_x: f64 = bounds.min()[0];
|
let min_x: f64 = bounds.min()[0];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user