1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Return plot transforms (#2935)

* Expose the plot transform to users

* Rename plot::ScreenTransform to PlotTransform

* Plot: return a PlotResponse with a transform member
This commit is contained in:
Emil Ernerfeldt
2023-04-19 17:01:16 +02:00
committed by GitHub
parent ce761e548f
commit d46cf067ea
7 changed files with 85 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
use std::f64::consts::TAU;
use std::ops::RangeInclusive;
use egui::plot::{AxisBools, GridInput, GridMark};
use egui::plot::{AxisBools, GridInput, GridMark, PlotResponse};
use egui::*;
use plot::{
Arrows, Bar, BarChart, BoxElem, BoxPlot, BoxSpread, CoordinatesFormatter, Corner, HLine,
@@ -751,9 +751,10 @@ impl InteractionDemo {
fn ui(&mut self, ui: &mut Ui) -> Response {
let plot = Plot::new("interaction_demo").height(300.0);
let InnerResponse {
let PlotResponse {
response,
inner: (screen_pos, pointer_coordinate, pointer_coordinate_drag_delta, bounds, hovered),
..
} = plot.show(ui, |plot_ui| {
(
plot_ui.screen_from_plot(PlotPoint::new(0.0, 0.0)),