Skip to content

Commit

Permalink
Inline push_argument_ruler and push_value_ruler.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Aug 6, 2022
1 parent f3ca9ef commit 31339f4
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions egui/src/widgets/plot/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,31 +1611,21 @@ fn add_rulers_and_text(

// Rulers for argument (usually vertical)
if show_argument {
let push_argument_ruler = |argument: PlotPoint, cursors: &mut Vec<Cursor>| {
let cursor = match orientation {
Orientation::Horizontal => Cursor::Horizontal { y: argument.y },
Orientation::Vertical => Cursor::Vertical { x: argument.x },
};
cursors.push(cursor);
};

for pos in elem.arguments_with_ruler() {
push_argument_ruler(pos, cursors);
cursors.push(match orientation {
Orientation::Horizontal => Cursor::Horizontal { y: pos.y },
Orientation::Vertical => Cursor::Vertical { x: pos.x },
});
}
}

// Rulers for values (usually horizontal)
if show_values {
let push_value_ruler = |value: PlotPoint, cursors: &mut Vec<Cursor>| {
let cursor = match orientation {
Orientation::Horizontal => Cursor::Vertical { x: value.x },
Orientation::Vertical => Cursor::Horizontal { y: value.y },
};
cursors.push(cursor);
};

for pos in elem.values_with_ruler() {
push_value_ruler(pos, cursors);
cursors.push(match orientation {
Orientation::Horizontal => Cursor::Vertical { x: pos.x },
Orientation::Vertical => Cursor::Horizontal { y: pos.y },
});
}
}

Expand Down

0 comments on commit 31339f4

Please sign in to comment.