MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / draw_crosshairs

Function draw_crosshairs

src/plot_renderer/canvas.rs:361–378  ·  view source on GitHub ↗
(frame: &mut Frame, state: &PlotState)

Source from the content-addressed store, hash-verified

359}
360
361fn draw_crosshairs(frame: &mut Frame, state: &PlotState) {
362 if !state.crosshairs_enabled {
363 return;
364 }
365
366 let pos = state.crosshairs_position;
367 let horizontal = canvas::Path::line(
368 iced::Point::new(0.0, pos.y),
369 iced::Point::new(state.bounds.width, pos.y),
370 );
371 let vertical = canvas::Path::line(
372 iced::Point::new(pos.x, 0.0),
373 iced::Point::new(pos.x, state.bounds.height),
374 );
375 let stroke = canvas::Stroke::default().with_color(crosshair_color());
376 frame.stroke(&horizontal, stroke);
377 frame.stroke(&vertical, stroke);
378}
379
380#[allow(clippy::too_many_arguments)]
381fn draw_marker(

Callers 1

drawFunction · 0.85

Calls 3

crosshair_colorFunction · 0.85
newFunction · 0.50
with_colorMethod · 0.45

Tested by

no test coverage detected