Skip to content

Fix min and max macro not enforcing limits when data flows #2464

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

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

mTvare6
Copy link
Contributor

@mTvare6 mTvare6 commented Mar 18, 2025

@Keavon Keavon marked this pull request as draft March 20, 2025 08:11
@Keavon
Copy link
Member

Keavon commented Mar 20, 2025

Requires hard/soft range rework discussed in Discord.

@mTvare6
Copy link
Contributor Author

mTvare6 commented Mar 22, 2025

@Keavon I've changed them into hard_min and min(considering it to be the default). Do let me know if it should instead be called soft_min.

@mTvare6 mTvare6 marked this pull request as ready for review March 22, 2025 05:16
@Keavon Keavon force-pushed the master branch 3 times, most recently from aa7ff13 to e11b57a Compare April 6, 2025 11:41
@@ -72,11 +73,11 @@ fn rectangle<T: CornerRadius>(
}

#[node_macro::node(category("Vector: Shape"))]
fn regular_polygon<T: AsU64>(
fn regular_polygon<T: AsU64 + std::cmp::PartialOrd + FromPrimitive>(
Copy link
Member

Choose a reason for hiding this comment

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

@TrueDoctor can we avoid needing to include these trait bounds for T here?

Copy link
Member

Choose a reason for hiding this comment

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

Yes I described the solution when this was discussed originally, I still might have the partial code for that somewhere. These bounds should basically automatically be added by the macro

Copy link
Member

Choose a reason for hiding this comment

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

But we can also add that as a todo and implement that later if there are enough users that not having it becomes annoying

@Keavon Keavon requested a review from TrueDoctor April 18, 2025 02:42
@TrueDoctor
Copy link
Member

Why do we have hard min and max but no hard/ soft ranges? And I'm not a fan of how the attributes are stored after parsing. Please choose a data representation which more closely aligns with what is a valid state. ( e.g. it shouldn't be possible to specify both hard and soft min and there should be a good error message in that case

@Keavon
Copy link
Member

Keavon commented Apr 18, 2025

Why do we have hard min and max but no hard/ soft ranges?

Range is always soft, it refers to how far left and right the draggable range slider goes. Specifying a range (to get the dragging slider kind of number input) and a hard min/max would be the expected way to set a range slider and prevent the user from typing values beyond the intended allowable bounds.

it shouldn't be possible to specify both hard and soft min and there should be a good error message in that case

If the soft min is larger than the hard min, that's allowed. But you're right that an error should be shown if they are equal (if so, soft should be removed) or reversed (this would indicate a mistake).

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.

3 participants