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

Make sure plot size is positive #4429

Merged
merged 6 commits into from May 11, 2024
Merged

Make sure plot size is positive #4429

merged 6 commits into from May 11, 2024

Conversation

rustbasic
Copy link
Contributor

Fix: in Plot, Minimum values for screen protection.

@emilk emilk added the egui_plot Related to egui_plot label May 10, 2024
@@ -105,7 +105,10 @@ impl super::View for ContextMenus {
.speed(1.0)
.prefix("Height: "),
);
self.width = self.width.at_least(1.0);
self.height = self.height.at_least(1.0);
Copy link
Owner

Choose a reason for hiding this comment

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

use DragValue::clamp_range instead

@rustbasic rustbasic requested a review from emilk May 11, 2024 09:03
Comment on lines 771 to 773
// Minimum values for screen protection
min_size.x = min_size.x.at_least(64.0);
min_size.y = min_size.y.at_least(15.0);
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we should do this. If the user wants a plot that is 16x32 pixels big, let them have it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should do this. If the user wants a plot that is 16x32 pixels big, let them have it

If it is greater than 1.0, panic does not occur, so it was set to 1.0.
If you want to edit it to a different size, please do so.

@rustbasic rustbasic requested a review from emilk May 11, 2024 12:33
@emilk emilk changed the title Fix: in Plot, Minimum values for screen protection. Make sure plot size is positive May 11, 2024
@emilk emilk merged commit 3b3ce22 into emilk:master May 11, 2024
19 checks passed
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.

Context Menus demo crashes on negative width or height
2 participants