Skip to content

Commit b551461

Browse files
authored
Refactor Plot::show_dyn internals (#161)
Closes #166 `show_dyn` is a massive function with non-trivial dependencies. This PR attempts to untangle it and make it easier to navigate and understand. # Public API changes: - simplified `show` lifetime Removed items from the public API --------------------------------- ``` -pub fn egui_plot::Plot<'a>::show<'b, R>(self, ui: &mut egui::ui::Ui, build_fn: impl core::ops::function::FnOnce(&mut egui_plot::PlotUi<'b>) -> R + 'a) -> egui_plot::PlotResponse<R> ``` Added items to the public API --------------------------------- ``` +pub fn egui_plot::Plot<'a>::show<R>(self, ui: &mut egui::ui::Ui, build_fn: impl core::ops::function::FnOnce(&mut egui_plot::PlotUi<'a>) -> R + 'a) -> egui_plot::PlotResponse<R> ```
1 parent 2605588 commit b551461

File tree

7 files changed

+478
-397
lines changed

7 files changed

+478
-397
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ check_branch_name:
188188

189189
check_todos_have_issues:
190190
# The code should not have TODOs without issue tracking. Format that must be followed is:
191-
# TODO #<issue_number>: <description>
192-
git ls-files | grep -P '\.rs$$' | xargs grep -Pi 'TODO(?! #\d+: \w+)' || exit 0; exit 1
191+
# TODO(#<issue_number>): <description>
192+
git ls-files | grep -P '\.rs$$' | xargs grep -Pi 'TODO(?!\(#\d+\): \w+)' || exit 0; exit 1
193193

194194
check_no_fixme:
195195
# The code should not have FIXME comments

demo/src/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl eframe::App for DemoGallery {
2828

2929
impl DemoGallery {
3030
// Width of a column in the thumbnails panel.
31-
// TODO #193: I don't know what units this corresponds to, and should be
31+
// TODO(#193): I don't know what units this corresponds to, and should be
3232
// cleaned up.
3333
const COL_WIDTH: f32 = 128.0;
3434

@@ -89,7 +89,7 @@ impl DemoGallery {
8989
// Set min_width so the heading is well rendered.
9090
.min_width(100.0)
9191
// 3 columns + some space extra for buttons.
92-
// TODO #193: get rid of "extra space" calc.
92+
// TODO(#193): get rid of "extra space" calc.
9393
.max_width(Self::COL_WIDTH * 3. + 30.)
9494
.resizable(true)
9595
.show(ctx, |ui| {
@@ -191,7 +191,7 @@ impl DemoGallery {
191191

192192
let button = {
193193
let texture = &self.thumbnail_textures[index];
194-
// TODO #193: I don't know what units this corresponds to, and should be
194+
// TODO(#193): I don't know what units this corresponds to, and should be
195195
// cleaned up.
196196
let image = egui::Image::new((texture.id(), Vec2::splat(110.0 * scale)));
197197
let mut button = egui::Button::image(image);

egui_plot/src/axis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'a> AxisWidget<'a> {
362362

363363
match HPlacement::from(self.hints.placement) {
364364
HPlacement::Left => {
365-
let angle = 0.0; // TODO #162: allow users to rotate text
365+
let angle = 0.0; // TODO(#162): allow users to rotate text
366366

367367
if angle == 0.0 {
368368
let x = self.rect.max.x - galley_size.x + SIDE_MARGIN;

egui_plot/src/items/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Contains items that can be added to a plot.
2-
#![expect(clippy::type_complexity)] // TODO #163: simplify some of the callback types with type aliases
2+
#![expect(clippy::type_complexity)] // TODO(#163): simplify some of the callback types with type aliases
33

44
use std::ops::RangeInclusive;
55

0 commit comments

Comments
 (0)