Bumped cimplot/implot version, added "axis equal"

- This commit also fixes an issue with legend rotation and orientation
  always being set to values even if the user did not specify any.
  This broke the interactive configuration of where the legend should
  be.
This commit is contained in:
4bb4 2020-12-12 12:38:50 +01:00
parent 3f67c8501e
commit 092a1908fe
5 changed files with 234 additions and 197 deletions

View file

@ -62,6 +62,22 @@ pub fn show_two_yaxis_plot(ui: &Ui, plot_ui: &PlotUi) {
});
}
pub fn show_axis_equal_plot(ui: &Ui, plot_ui: &PlotUi) {
ui.text(im_str!("This plot has axis equal set (1:1 aspect ratio)."));
let content_width = ui.window_content_region_width();
Plot::new("Axis equal line plot")
// The size call could also be omitted, though the defaults don't consider window
// width, which is why we're not doing so here.
.size(content_width, 300.0)
.with_plot_flags(&(PlotFlags::NONE | PlotFlags::AXIS_EQUAL))
.build(plot_ui, || {
// If this is called outside a plot build callback, the program will panic.
let x_positions = vec![0.1, 0.9];
let y_positions = vec![0.1, 0.9];
PlotLine::new("legend label").plot(&x_positions, &y_positions);
});
}
pub fn show_configurable_plot(ui: &Ui, plot_ui: &PlotUi) {
ui.text(im_str!(
"This header demos what we can configure about plots."
@ -321,4 +337,7 @@ pub fn show_demo_headers(ui: &Ui, plot_ui: &PlotUi) {
if CollapsingHeader::new(im_str!("Line plot: Multiple Y Axes")).build(&ui) {
show_two_yaxis_plot(&ui, &plot_ui);
}
if CollapsingHeader::new(im_str!("Line plot: \"Axis equal\"")).build(&ui) {
show_axis_equal_plot(&ui, &plot_ui);
}
}