-
Notifications
You must be signed in to change notification settings - Fork 123
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
shadow and slider #819
base: main
Are you sure you want to change the base?
shadow and slider #819
Conversation
- add `corner_radius` field to `ShadowStyle` struct to allow custom shadow corner radius - update `shadow` method to accept `corner_radius` parameter - modify shadow rendering logic to use `draw_blurred_rounded_rect_in` with specified corner radius - update tests to include `None` for `corner_radius` parameter - add snapshot tests for label box with shadow, shadow with border, and shadow with rounded corners
- Added support for vertical orientation in slider widget - Implemented hover glow effect with customizable color, blur, and spread radius - Added track color customization - Introduced step functionality for precise value selection - Improved slider interaction with grab anchor and editing state tracking - Enhanced visual appearance with rounded corners for thumb and track - Added comprehensive test cases for new slider functionality - Updated shadow example to demonstrate new slider capabilities - Improved documentation and code organization for slider widget
A few notes:
|
It is? |
Sure - the per-pixel maths is significantly more expensive than just blitting a solid colour. Unless you mean that we should have a fast-path in Vello (i.e. splitting blurred_rounded_rect into the solid part and the non-solid part), which I guess would be not too unreasonable |
Oh, I thought you meant it had some sort of hidden cost. This specific use-case is the one we added blurred rectangles for, so I wouldn't worry about the per-pixel cost. |
let shadow_rect = size | ||
.to_rect() | ||
.inset(-shadow.spread_radius) | ||
.to_rounded_rect(corner_radius); | ||
|
||
scene.draw_blurred_rounded_rect_in( | ||
&shadow_rect, | ||
Affine::translate(shadow.offset), | ||
shadow_rect.rect(), | ||
shadow.color, | ||
shadow.corner_radius.unwrap_or(corner_radius.top_left), | ||
shadow.blur_radius, | ||
); |
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.
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.
(Oh... It already is using blurred_rounded_rect... Oops)
@snooowfire is my secondary account. Some of the code was developed on my WSL, where I logged in with my secondary account's git. I think it’s indeed worth separating into two PRs. There are still many tests to write for the slider part, but I’m not very familiar with how to properly implement tests for masonry. If I have time, I will prioritize splitting out and submitting the slider implementation first, followed by the shadow implementation. |
shadow.mp4
This is a simple implementation with many areas that can still be improved. It serves as a reference for those who want to implement corresponding functionalities in the future. Currently, I haven't thoroughly researched the testing part, and the tests are mostly not passing. However, it can run a simple example