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

Method draw_cursor

egui_plot/src/plot.rs:1390–1420  ·  view source on GitHub ↗
(
        cursors: &[Cursor],
        always: bool,
        shapes: &mut Vec<Shape>,
        line_color: Color32,
        draw_cursor_xy: Vec2b,
        transform: &PlotTransform,
    )

Source from the content-addressed store, hash-verified

1388 }
1389
1390 fn draw_cursor(
1391 cursors: &[Cursor],
1392 always: bool,
1393 shapes: &mut Vec<Shape>,
1394 line_color: Color32,
1395 draw_cursor_xy: Vec2b,
1396 transform: &PlotTransform,
1397 ) {
1398 for &cursor in cursors {
1399 match cursor {
1400 Cursor::Horizontal { y } => {
1401 if draw_cursor_xy.y || always {
1402 shapes.push(horizontal_line(
1403 transform.position_from_point(&PlotPoint::new(0.0, y)),
1404 transform,
1405 line_color,
1406 ));
1407 }
1408 }
1409 Cursor::Vertical { x } => {
1410 if draw_cursor_xy.x || always {
1411 shapes.push(vertical_line(
1412 transform.position_from_point(&PlotPoint::new(x, 0.0)),
1413 transform,
1414 line_color,
1415 ));
1416 }
1417 }
1418 }
1419 }
1420 }
1421
1422 fn show_coordinates(
1423 ui: &Ui,

Callers

nothing calls this directly

Calls 3

horizontal_lineFunction · 0.85
vertical_lineFunction · 0.85
position_from_pointMethod · 0.80

Tested by

no test coverage detected