MCPcopy Create free account
hub / github.com/emilk/egui_plot / paint_grid

Method paint_grid

egui_plot/src/plot.rs:1367–1388  ·  view source on GitHub ↗
(
        &self,
        ui: &Ui,
        shapes: &mut Vec<Shape>,
        items: &[Box<dyn PlotItem + '_>],
        transform: &PlotTransform,
    )

Source from the content-addressed store, hash-verified

1365 }
1366
1367 fn paint_grid(
1368 &self,
1369 ui: &Ui,
1370 shapes: &mut Vec<Shape>,
1371 items: &[Box<dyn PlotItem + '_>],
1372 transform: &PlotTransform,
1373 ) {
1374 let mut axes_shapes = Vec::new();
1375 // Use ui to access style information and context for painting grid lines
1376 if self.show_grid.x {
1377 self.paint_grid_direction(ui, &mut axes_shapes, Axis::X, items, transform);
1378 }
1379 if self.show_grid.y {
1380 self.paint_grid_direction(ui, &mut axes_shapes, Axis::Y, items, transform);
1381 }
1382 // Sort the axes by strength so that those with higher strength are drawn in
1383 // front.
1384 axes_shapes.sort_by(|(_, strength1), (_, strength2)| strength1.total_cmp(strength2));
1385
1386 // Return just the shapes.
1387 shapes.extend(axes_shapes.into_iter().map(|(shape, _)| shape));
1388 }
1389
1390 fn draw_cursor(
1391 cursors: &[Cursor],

Callers 1

collect_shapesMethod · 0.80

Calls 1

paint_grid_directionMethod · 0.80

Tested by

no test coverage detected