Skip to content

Commit

Permalink
Update mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Dec 31, 2024
1 parent 6a7ff72 commit 9e7ae81
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions egui_plot/src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use std::ops::RangeInclusive;

use egui::{
emath::GuiRounding,
emath::Rot2,
epaint::{CircleShape, TextShape},
pos2, vec2, Align2, Color32, Id, ImageOptions, Mesh, NumExt as _, Pos2, Rect, Rgba, Rounding,
Expand Down Expand Up @@ -223,12 +224,12 @@ impl PlotItem for HLine {

// Round to minimize aliasing:
let points = vec![
ui.painter().round_pos_to_pixels(
transform.position_from_point(&PlotPoint::new(transform.bounds().min[0], *y)),
),
ui.painter().round_pos_to_pixels(
transform.position_from_point(&PlotPoint::new(transform.bounds().max[0], *y)),
),
transform
.position_from_point(&PlotPoint::new(transform.bounds().min[0], *y))
.round_to_pixels(ui.pixels_per_point()),
transform
.position_from_point(&PlotPoint::new(transform.bounds().max[0], *y))
.round_to_pixels(ui.pixels_per_point()),
];
style.style_line(points, *stroke, *highlight, shapes);
}
Expand Down Expand Up @@ -371,12 +372,12 @@ impl PlotItem for VLine {

// Round to minimize aliasing:
let points = vec![
ui.painter().round_pos_to_pixels(
transform.position_from_point(&PlotPoint::new(*x, transform.bounds().min[1])),
),
ui.painter().round_pos_to_pixels(
transform.position_from_point(&PlotPoint::new(*x, transform.bounds().max[1])),
),
transform
.position_from_point(&PlotPoint::new(*x, transform.bounds().min[1]))
.round_to_pixels(ui.pixels_per_point()),
transform
.position_from_point(&PlotPoint::new(*x, transform.bounds().max[1]))
.round_to_pixels(ui.pixels_per_point()),
];
style.style_line(points, *stroke, *highlight, shapes);
}
Expand Down

0 comments on commit 9e7ae81

Please sign in to comment.