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

egui_plot: Force use of min_auto_bounds if auto_bounds is disabled by default. Fixes #3893. #4539

Closed
wants to merge 1 commit into from

Conversation

aholtzma-am
Copy link

The logic for determining bounds was not using the values supplied by include_x()/include_y() after the initial plot call when auto_bounds() was false. This change forces the use of the manual limits when default_auto_bounds is false.

@aholtzma
Copy link

Looks like this just needs a label applied.

@emilk emilk added the egui_plot Related to egui_plot label May 31, 2024
Comment on lines +978 to 979
if !default_auto_bounds.x || mem.auto_bounds.x {
bounds.set_x(&min_auto_bounds);
Copy link
Owner

@emilk emilk May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads backwards to me now. If the user has said "DON'T apply automatic bounds" then we set the bounds to min_auto_bounds

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min_auto_bounds includes the bounds manually specified by include_x()/include_y(). So if you turn off auto bounds, and supply bounds via include_xy(), it won't use them except for the first call.

@Fabus1184
Copy link
Contributor

Perhaps it would be better to factor this out into two methods, expand_{x,y} to expand the bounds to always show the specified value, and limit_{x,y} to limit the axis range, both applying regardless of whether auto bounds is active or not.
Of course if the user moves the plot, this should not apply. You could always disallow moving the plot if you don't want that.

@emilk
Copy link
Owner

emilk commented Jul 15, 2024

egui_plot has recently been moved to its own repository, at https://github.com/emilk/egui_plot

This will hopefully speed up its development by having more reviewers and maintainers.

Please re-open this PR at https://github.com/emilk/egui_plot/pulls

See also:

@emilk emilk closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_plot Related to egui_plot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

egui_plot 0.25.0 - No auto_bounds + include_X/Y does not render anything until double click
4 participants