Skip to content

Conversation

Resonanz
Copy link

@Resonanz Resonanz commented Sep 4, 2025

The goal of this pull request is to add many more detailed comments to the radio_button widget code to help better understand the new atom-based widgets.

A visual diff has been completed and the demo app has been compiled to check for errors or warning:

cargo run --release -p egui_demo_app

The comments were written by Claude AI and have been entirely checked to the best of my ability.

@Resonanz Resonanz changed the title Add much more detailed comments throughout the new atom-based widget Add much more detailed comments throughout the new atom-based radio_button widget Sep 4, 2025
Resonanz and others added 2 commits September 4, 2025 20:44
Added button and checkbox documentation (previously added radio_button documentation).
use crate::{
Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame,
Image, IntoAtoms, NumExt as _, Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2,
Widget, WidgetInfo, WidgetText, WidgetType,
Copy link
Contributor

Choose a reason for hiding this comment

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

are these comments really needed??
this so much more lines which I don't really think we need

Copy link
Author

Choose a reason for hiding this comment

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

I think having a heavily documented widget is helpful for those that are new to rust, or who are finding their way to how widgets work, or who require a more in-depth explanation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that comments inside functions and doc-comments over it are helpful (I didn't read those ones), but commenting of imports is superfluous. That documentation should be on the imported things itself.

@@ -1,137 +1,311 @@
// Import necessary types and traits from the crate
use crate::{
Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

// Import necessary types and traits from the crate
use crate::{
Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Ui, Vec2, Widget,
WidgetInfo, WidgetType, epaint,
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

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

I feel it adds a lot of noise with little value, as ai tends to do. I don't think we should merge it, but we can keep the PR around, (maybe even link it from somewhere), in case someone wants to read this.

Comment on lines +252 to +254
// Get visual styling based on the widget's interaction state
// Note: We use the general interact() method instead of interact_selectable()
// because the selectable version can be "too colorful" according to the comment
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lol, according to what comment?

Comment on lines +585 to 588
// Small buttons get no vertical padding
if small {
button_padding.y = 0.0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like the majority of code comments don't add much value. Do you really need a comment to know that this disables vertical padding for small buttons?

In general, code should be written in a way that makes it obvious what is going on, and comments should explain things that aren't obvious from the code, for example why something is done.

@emilk
Copy link
Owner

emilk commented Sep 9, 2025

If you think these comments are useful, then you can generate them locally (like you did). No need to commit them.

@emilk emilk closed this Sep 9, 2025
@bircni
Copy link
Contributor

bircni commented Sep 15, 2025

this just feels like copilot was told to comment the project xD

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 this pull request may close these issues.

5 participants