-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
base: master
Are you sure you want to change the base?
Conversation
Requires hard/soft range rework discussed in Discord. |
@Keavon I've changed them into |
aa7ff13
to
e11b57a
Compare
@@ -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>( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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 |
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.
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). |
Fixes https://discord.com/channels/731730685944922173/731738914812854303/1351538875390099507.