(
widget: &PlotWidget,
state: &mut PlotState,
effects: &mut UpdateEffects,
)
| 1386 | } |
| 1387 | picking::HoverRequest::RequestedGpu => { |
| 1388 | // Keep drawing until the result arrives. |
| 1389 | effects.needs_redraw = true; |
| 1390 | } |
| 1391 | } |
| 1392 | } |
| 1393 | |
| 1394 | fn update_cursor_overlay_on_move( |
| 1395 | widget: &PlotWidget, |
| 1396 | state: &PlotState, |
| 1397 | effects: &mut UpdateEffects, |
| 1398 | ) { |
| 1399 | if !widget.cursor_overlay { |
| 1400 | return; |
| 1401 | } |
| 1402 | if state.cursor_inside() { |
| 1403 | let viewport = Vec2::new(state.bounds.width, state.bounds.height); |
| 1404 | let plot = state.camera.screen_to_world( |
| 1405 | DVec2::new( |
| 1406 | state.cursor_position.x as f64, |
| 1407 | state.cursor_position.y as f64, |
| 1408 | ), |
| 1409 | DVec2::new(viewport.x as f64, viewport.y as f64), |
| 1410 | ); |
| 1411 | let Some(world) = |
| 1412 | plot_point_to_data([plot.x, plot.y], widget.x_axis_scale, widget.y_axis_scale) |
| 1413 | else { |
| 1414 | effects.clear_cursor_position = true; |
| 1415 | return; |
| 1416 | }; |
| 1417 | let text = if let Some(p) = &widget.cursor_provider { |
| 1418 | (p)(world[0], world[1]) |
| 1419 | } else { |
| 1420 | format!("{:.4}, {:.4}", world[0], world[1]) |
| 1421 | }; |
no test coverage detected