Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved plot interaction methods #891

Closed
EmbersArc opened this issue Nov 13, 2021 · 1 comment · Fixed by #892
Closed

Improved plot interaction methods #891

EmbersArc opened this issue Nov 13, 2021 · 1 comment · Fixed by #892

Comments

@EmbersArc
Copy link
Contributor

#766 has just been merged and is usable, I'd like to add the following features next:

  • Access to Ui (or the context?) inside the closure as well. Either through the plot_ui struct or as a second argument.
  • A plot_to_screen conversion, to enable custom drawing in screen coordinates based on items in the plot.
  • A way to get the current plot bounds.
  • Fix the plot_from_screen function. Pretty sure I messed up hard when writing it and it likely does not work as expected right now.
@emilk
Copy link
Owner

emilk commented Nov 14, 2021

Access to Ui (at least to a &mut Ui) seems like a dangerous footgun to me, as that will invariable lead to users doing stuff like

Plot::new().show(|ui, plot_ui| {
    ui.label("Where will this end up?");
});

I think a plot_ui.ctx() accessor to get a &CtxRef makes sense though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants